diff --git a/external/glib/CMakeLists.txt b/external/glib/CMakeLists.txt index 3c6fe4be..c862705f 100644 --- a/external/glib/CMakeLists.txt +++ b/external/glib/CMakeLists.txt @@ -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) diff --git a/external/glib/generate_cppgir.cmake b/external/glib/generate_cppgir.cmake index c15d3f9e..2ad82277 100644 --- a/external/glib/generate_cppgir.cmake +++ b/external/glib/generate_cppgir.cmake @@ -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) @@ -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}") @@ -33,7 +39,7 @@ function(generate_cppgir target_name gir) --class --class-full --expected - --ignore + "$<$:--ignore>" "$" --output ${gen_dst}