Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look for system-wide cppgir before fallback to the bundled copy #305

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion external/glib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ function(add_cppgir) # isolate scope
set(BUILD_EXAMPLES OFF)
add_subdirectory(cppgir EXCLUDE_FROM_ALL)
endfunction()
add_cppgir()

include(generate_cppgir.cmake)
if (NOT CppGir_FOUND)
add_cppgir()
endif()
generate_cppgir(external_glib Gio-2.0)

find_package(PkgConfig REQUIRED)
Expand Down
16 changes: 11 additions & 5 deletions external/glib/generate_cppgir.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL

find_package(CppGir 2.0)

function(generate_cppgir target_name gir)
set(cppgir_loc ${cmake_helpers_loc}/external/glib/cppgir)

Expand All @@ -13,10 +15,14 @@ function(generate_cppgir target_name gir)

set(gen_timestamp ${gen_dst}/${target_name}_cppgir.timestamp)

set(ignore_files
${cppgir_loc}/data/cppgir.ignore
${cppgir_loc}/data/cppgir_unix.ignore
)
if (NOT CppGir_FOUND)
set(ignore_files
${cppgir_loc}/data/cppgir.ignore
${cppgir_loc}/data/cppgir_unix.ignore
)
else()
set(ignore_files) # rely on default ignore list
endif()

set(gir_path)
if (IS_ABSOLUTE "${gir}")
Expand All @@ -33,7 +39,7 @@ function(generate_cppgir target_name gir)
--class
--class-full
--expected
--ignore
"$<$<BOOL:${ignore_files}>:--ignore>"
"$<JOIN:${ignore_files},:>"
--output
${gen_dst}
Expand Down