From a171a26ecfd19bc7abe96a10bdce7459f1f8cf2f Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Tue, 22 Nov 2022 07:54:38 +0200 Subject: [PATCH] Add ALLOW_MISSING_GCONF build option --- CMakeLists.txt | 1 + gconf-migration/CMakeLists.txt | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64539e5..85a015b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ add_custom_target(uninstall ) option(ENABLE_GCONF_MIGRATION "Enables GConf to GSettings migration for existing alarms (and adds a dependency to GConf)." ON) +option(ALLOW_MISSING_GCONF "Allows the project to build with GConf missing. Useful for existing installations (AUR) that already had GConf." OFF) if(ENABLE_GCONF_MIGRATION) add_subdirectory("gconf-migration") endif() diff --git a/gconf-migration/CMakeLists.txt b/gconf-migration/CMakeLists.txt index 9b713be..ba520d6 100644 --- a/gconf-migration/CMakeLists.txt +++ b/gconf-migration/CMakeLists.txt @@ -1,6 +1,15 @@ # SPDX-License-Identifier: GPL-2.0-or-later -pkg_check_modules(GCONF2 REQUIRED gconf-2.0) pkg_check_modules(GIO REQUIRED gio-2.0) +pkg_check_modules(GCONF2 gconf-2.0) +if(NOT GCONF2_FOUND) + if(ALLOW_MISSING_GCONF) + message(WARNING "GConf was not found but the package will still be built.\nIf you want to migrate old alarms created by alarm-clock-applet < 0.4.0, please install GConf and re-run CMake/rebuild the package.") + add_custom_target(alarm-clock-applet-gconf-migration) + return() + else() + message(FATAL_ERROR "GConf not found.\nPlease install it or pass `-DENABLE_GCONF_MIGRATION=OFF` if you do not want to migrate alarms created by alarm-clock-applet < 0.4.0.") + endif() +endif() add_executable(alarm-clock-applet-gconf-migration alarm-clock-gconf-migration.c) set_property(TARGET alarm-clock-applet-gconf-migration PROPERTY C_STANDARD 11)