From eddf17c68274c3e8ecf86a13858243159ffe9714 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sun, 23 Apr 2017 10:01:40 +0200 Subject: cmake/signal-protocol: shared lib, mark_as_advanced and others --- cmake/FindATK.cmake | 15 +++++++-------- cmake/FindCairo.cmake | 15 +++++++-------- cmake/FindGCrypt.cmake | 10 ++++++---- cmake/FindGDK3.cmake | 24 ++++++++---------------- cmake/FindGDKPixbuf2.cmake | 11 +++++------ cmake/FindGIO.cmake | 7 +++---- cmake/FindGLib.cmake | 15 +++++++-------- cmake/FindGModule.cmake | 7 +++---- cmake/FindGObject.cmake | 7 +++---- cmake/FindGPGME.cmake | 10 ++++++---- cmake/FindGTK3.cmake | 15 +++++++-------- cmake/FindGee.cmake | 4 +--- cmake/FindGettext.cmake | 8 +++++--- cmake/FindLibnotify.cmake | 11 ++++++----- cmake/FindPango.cmake | 11 ++++++----- cmake/FindSQLite3.cmake | 11 +++++------ cmake/FindSignalProtocol.cmake | 10 ++++++++++ cmake/FindVala.cmake | 1 + cmake/PkgConfigWithFallback.cmake | 31 +++++++++++++++++-------------- 19 files changed, 113 insertions(+), 110 deletions(-) create mode 100644 cmake/FindSignalProtocol.cmake (limited to 'cmake') diff --git a/cmake/FindATK.cmake b/cmake/FindATK.cmake index bdd25897..c14a32b1 100644 --- a/cmake/FindATK.cmake +++ b/cmake/FindATK.cmake @@ -8,14 +8,15 @@ find_pkg_config_with_fallback(ATK ) if(ATK_FOUND AND NOT ATK_VERSION) - find_path(ATK_INCLUDE_DIR "atk/atk.h" HINTS ${ATK_INCLUDE_DIRS}) + find_file(ATK_VERSION_HEADER "atk/atkversion.h" HINTS ${ATK_INCLUDE_DIRS}) + mark_as_advanced(ATK_VERSION_HEADER) - if(ATK_INCLUDE_DIR) - file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MAJOR_VERSION REGEX "^#define ATK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") + if(ATK_VERSION_HEADER) + file(STRINGS "${ATK_VERSION_HEADER}" ATK_MAJOR_VERSION REGEX "^#define ATK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define ATK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" ATK_MAJOR_VERSION "${ATK_MAJOR_VERSION}") - file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MINOR_VERSION REGEX "^#define ATK_MINOR_VERSION +\\(?([0-9]+)\\)?$") + file(STRINGS "${ATK_VERSION_HEADER}" ATK_MINOR_VERSION REGEX "^#define ATK_MINOR_VERSION +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define ATK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" ATK_MINOR_VERSION "${ATK_MINOR_VERSION}") - file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MICRO_VERSION REGEX "^#define ATK_MICRO_VERSION +\\(?([0-9]+)\\)?$") + file(STRINGS "${ATK_VERSION_HEADER}" ATK_MICRO_VERSION REGEX "^#define ATK_MICRO_VERSION +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define ATK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" ATK_MICRO_VERSION "${ATK_MICRO_VERSION}") set(ATK_VERSION "${ATK_MAJOR_VERSION}.${ATK_MINOR_VERSION}.${ATK_MICRO_VERSION}") unset(ATK_MAJOR_VERSION) @@ -26,7 +27,5 @@ endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(ATK - FOUND_VAR ATK_FOUND REQUIRED_VARS ATK_LIBRARY - VERSION_VAR ATK_VERSION -) \ No newline at end of file + VERSION_VAR ATK_VERSION) \ No newline at end of file diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake index 5d2a2fbf..5277b1bb 100644 --- a/cmake/FindCairo.cmake +++ b/cmake/FindCairo.cmake @@ -7,14 +7,15 @@ find_pkg_config_with_fallback(Cairo ) if(Cairo_FOUND AND NOT Cairo_VERSION) - find_path(Cairo_INCLUDE_DIR "cairo.h" HINTS ${Cairo_INCLUDE_DIRS}) + find_file(Cairo_VERSION_HEADER "cairo-version.h" HINTS ${Cairo_INCLUDE_DIRS}) + mark_as_advanced(Cairo_VERSION_HEADER) - if(Cairo_INCLUDE_DIR) - file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_MAJOR_VERSION REGEX "^#define CAIRO_VERSION_MAJOR +\\(?([0-9]+)\\)?$") + if(Cairo_VERSION_HEADER) + file(STRINGS "${Cairo_VERSION_HEADER}" Cairo_MAJOR_VERSION REGEX "^#define CAIRO_VERSION_MAJOR +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define CAIRO_VERSION_MAJOR \\(?([0-9]+)\\)?$" "\\1" Cairo_MAJOR_VERSION "${Cairo_MAJOR_VERSION}") - file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_MINOR_VERSION REGEX "^#define CAIRO_VERSION_MINOR +\\(?([0-9]+)\\)?$") + file(STRINGS "${Cairo_VERSION_HEADER}" Cairo_MINOR_VERSION REGEX "^#define CAIRO_VERSION_MINOR +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define CAIRO_VERSION_MINOR \\(?([0-9]+)\\)?$" "\\1" Cairo_MINOR_VERSION "${Cairo_MINOR_VERSION}") - file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_MICRO_VERSION REGEX "^#define CAIRO_VERSION_MICRO +\\(?([0-9]+)\\)?$") + file(STRINGS "${Cairo_VERSION_HEADER}" Cairo_MICRO_VERSION REGEX "^#define CAIRO_VERSION_MICRO +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define CAIRO_VERSION_MICRO \\(?([0-9]+)\\)?$" "\\1" Cairo_MICRO_VERSION "${Cairo_MICRO_VERSION}") set(Cairo_VERSION "${Cairo_MAJOR_VERSION}.${Cairo_MINOR_VERSION}.${Cairo_MICRO_VERSION}") unset(Cairo_MAJOR_VERSION) @@ -25,7 +26,5 @@ endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Cairo - FOUND_VAR Cairo_FOUND REQUIRED_VARS Cairo_LIBRARY - VERSION_VAR Cairo_VERSION -) \ No newline at end of file + VERSION_VAR Cairo_VERSION) \ No newline at end of file diff --git a/cmake/FindGCrypt.cmake b/cmake/FindGCrypt.cmake index 7c6b2173..250f90c9 100644 --- a/cmake/FindGCrypt.cmake +++ b/cmake/FindGCrypt.cmake @@ -39,10 +39,12 @@ if(GCrypt_CONFIG_EXECUTABLE) OUTPUT_STRIP_TRAILING_WHITESPACE) gcrypt_config_fail(${ERRCODE}) - string(REGEX REPLACE "^(.* |)-l([^ ]*gcrypt[^ ]*)( .*|)$" "\\2" GCrypt_LIBRARY "${GCrypt_LDFLAGS}") + string(REGEX REPLACE "^(.* |)-l([^ ]*gcrypt[^ ]*)( .*|)$" "\\2" GCrypt_LIBRARY_NAME "${GCrypt_LDFLAGS}") string(REGEX REPLACE "^(.* |)-L([^ ]*)( .*|)$" "\\2" GCrypt_LIBRARY_DIRS "${GCrypt_LDFLAGS}") - find_library(LIB_NAME_GCrypt ${GCrypt_LIBRARY} HINTS ${GCrypt_LIBRARY_DIRS}) - set(GCrypt_LIBRARY ${LIB_NAME_GCrypt}) + find_library(GCrypt_LIBRARY ${GCrypt_LIBRARY_NAME} HINTS ${GCrypt_LIBRARY_DIRS}) + mark_as_advanced(GCrypt_LIBRARY) + unset(GCrypt_LIBRARY_NAME) + unset(GCrypt_LIBRARY_DIRS) if(NOT TARGET gcrypt) add_library(gcrypt INTERFACE IMPORTED) @@ -54,4 +56,4 @@ endif(GCrypt_CONFIG_EXECUTABLE) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GCrypt REQUIRED_VARS GCrypt_LIBRARY - VERSION_VAR GCrypt_VERSION) \ No newline at end of file + VERSION_VAR GCrypt_VERSION) diff --git a/cmake/FindGDK3.cmake b/cmake/FindGDK3.cmake index fe8e13e5..f90868e1 100644 --- a/cmake/FindGDK3.cmake +++ b/cmake/FindGDK3.cmake @@ -8,14 +8,15 @@ find_pkg_config_with_fallback(GDK3 ) if(GDK3_FOUND AND NOT GDK3_VERSION) - find_path(GDK3_INCLUDE_DIR "gdk/gdk.h" HINTS ${GDK3_INCLUDE_DIRS}) + find_file(GDK3_VERSION_HEADER "gdk/gdkversionmacros.h" HINTS ${GDK3_INCLUDE_DIRS}) + mark_as_advanced(GDK3_VERSION_HEADER) - if(GDK3_INCLUDE_DIR) - file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MAJOR_VERSION REGEX "^#define GDK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") + if(GDK3_VERSION_HEADER) + file(STRINGS "${GDK3_VERSION_HEADER}" GDK3_MAJOR_VERSION REGEX "^#define GDK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define GDK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK3_MAJOR_VERSION "${GDK3_MAJOR_VERSION}") - file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MINOR_VERSION REGEX "^#define GDK_MINOR_VERSION +\\(?([0-9]+)\\)?$") + file(STRINGS "${GDK3_VERSION_HEADER}" GDK3_MINOR_VERSION REGEX "^#define GDK_MINOR_VERSION +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define GDK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK3_MINOR_VERSION "${GDK3_MINOR_VERSION}") - file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MICRO_VERSION REGEX "^#define GDK_MICRO_VERSION +\\(?([0-9]+)\\)?$") + file(STRINGS "${GDK3_VERSION_HEADER}" GDK3_MICRO_VERSION REGEX "^#define GDK_MICRO_VERSION +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define GDK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK3_MICRO_VERSION "${GDK3_MICRO_VERSION}") set(GDK3_VERSION "${GDK3_MAJOR_VERSION}.${GDK3_MINOR_VERSION}.${GDK3_MICRO_VERSION}") unset(GDK3_MAJOR_VERSION) @@ -25,19 +26,10 @@ if(GDK3_FOUND AND NOT GDK3_VERSION) endif() if(GDK3_FOUND) - find_path(GDK3_INCLUDE_DIR "gdk/gdk.h" HINTS ${GDK3_INCLUDE_DIRS}) - unset(GDK3_WITH_X11) - - if(GDK3_INCLUDE_DIR) - if(EXISTS "${GDK3_INCLUDE_DIR}/gdk/gdkx.h") - set(GDK3_WITH_X11 yes) - endif() - endif() + find_file(GDK3_WITH_X11 "gdk/gdkx.h" HINTS ${GDK3_INCLUDE_DIRS}) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GDK3 - FOUND_VAR GDK3_FOUND REQUIRED_VARS GDK3_LIBRARY - VERSION_VAR GDK3_VERSION -) \ No newline at end of file + VERSION_VAR GDK3_VERSION) \ No newline at end of file diff --git a/cmake/FindGDKPixbuf2.cmake b/cmake/FindGDKPixbuf2.cmake index d100deea..3b7eaf5d 100644 --- a/cmake/FindGDKPixbuf2.cmake +++ b/cmake/FindGDKPixbuf2.cmake @@ -8,17 +8,16 @@ find_pkg_config_with_fallback(GDKPixbuf2 ) if(GDKPixbuf2_FOUND AND NOT GDKPixbuf2_VERSION) - find_path(GDKPixbuf2_INCLUDE_DIR "gdk-pixbuf/gdk-pixbuf.h" HINTS ${GDKPixbuf2_INCLUDE_DIRS}) + find_file(GDKPixbuf2_FEATURES_HEADER "gdk-pixbuf/gdk-pixbuf-features.h" HINTS ${GDKPixbuf2_INCLUDE_DIRS}) + mark_as_advanced(GDKPixbuf2_FEATURES_HEADER) - if(GDKPixbuf2_INCLUDE_DIR) - file(STRINGS "${GDKPixbuf2_INCLUDE_DIR}/gdk-pixbuf/gdk-pixbuf-features.h" GDKPixbuf2_VERSION REGEX "^#define GDK_PIXBUF_VERSION \\\"[^\\\"]+\\\"") + if(GDKPixbuf2_FEATURES_HEADER) + file(STRINGS "${GDKPixbuf2_FEATURES_HEADER}" GDKPixbuf2_VERSION REGEX "^#define GDK_PIXBUF_VERSION \\\"[^\\\"]+\\\"") string(REGEX REPLACE "^#define GDK_PIXBUF_VERSION \\\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\\\"$" "\\1.\\2.\\3" GDKPixbuf2_VERSION "${GDKPixbuf2_VERSION}") endif() endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GDKPixbuf2 - FOUND_VAR GDKPixbuf2_FOUND REQUIRED_VARS GDKPixbuf2_LIBRARY - VERSION_VAR GDKPixbuf2_VERSION -) \ No newline at end of file + VERSION_VAR GDKPixbuf2_VERSION) \ No newline at end of file diff --git a/cmake/FindGIO.cmake b/cmake/FindGIO.cmake index d65749dd..7d2fd65b 100644 --- a/cmake/FindGIO.cmake +++ b/cmake/FindGIO.cmake @@ -8,13 +8,12 @@ find_pkg_config_with_fallback(GIO ) if(GIO_FOUND AND NOT GIO_VERSION) - find_package(GLib) + # TODO + find_package(GLib ${GLib_GLOBAL_VERSION}) set(GIO_VERSION ${GLib_VERSION}) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GIO - FOUND_VAR GIO_FOUND REQUIRED_VARS GIO_LIBRARY - VERSION_VAR GIO_VERSION -) \ No newline at end of file + VERSION_VAR GIO_VERSION) \ No newline at end of file diff --git a/cmake/FindGLib.cmake b/cmake/FindGLib.cmake index eb054e65..a2feeecc 100644 --- a/cmake/FindGLib.cmake +++ b/cmake/FindGLib.cmake @@ -9,14 +9,15 @@ find_pkg_config_with_fallback(GLib ) if(GLib_FOUND AND NOT GLib_VERSION) - find_path(GLib_CONFIG_INCLUDE_DIR "glibconfig.h" HINTS ${GLib_INCLUDE_DIRS}) + find_file(GLib_CONFIG_HEADER "glibconfig.h" HINTS ${GLib_INCLUDE_DIRS}) + mark_as_advanced(GLib_CONFIG_HEADER) - if(GLib_CONFIG_INCLUDE_DIR) - file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MAJOR_VERSION REGEX "^#define GLIB_MAJOR_VERSION +([0-9]+)") + if(GLib_CONFIG_HEADER) + file(STRINGS "${GLib_CONFIG_HEADER}" GLib_MAJOR_VERSION REGEX "^#define GLIB_MAJOR_VERSION +([0-9]+)") string(REGEX REPLACE "^#define GLIB_MAJOR_VERSION ([0-9]+)$" "\\1" GLib_MAJOR_VERSION "${GLib_MAJOR_VERSION}") - file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MINOR_VERSION REGEX "^#define GLIB_MINOR_VERSION +([0-9]+)") + file(STRINGS "${GLib_CONFIG_HEADER}" GLib_MINOR_VERSION REGEX "^#define GLIB_MINOR_VERSION +([0-9]+)") string(REGEX REPLACE "^#define GLIB_MINOR_VERSION ([0-9]+)$" "\\1" GLib_MINOR_VERSION "${GLib_MINOR_VERSION}") - file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MICRO_VERSION REGEX "^#define GLIB_MICRO_VERSION +([0-9]+)") + file(STRINGS "${GLib_CONFIG_HEADER}" GLib_MICRO_VERSION REGEX "^#define GLIB_MICRO_VERSION +([0-9]+)") string(REGEX REPLACE "^#define GLIB_MICRO_VERSION ([0-9]+)$" "\\1" GLib_MICRO_VERSION "${GLib_MICRO_VERSION}") set(GLib_VERSION "${GLib_MAJOR_VERSION}.${GLib_MINOR_VERSION}.${GLib_MICRO_VERSION}") unset(GLib_MAJOR_VERSION) @@ -27,7 +28,5 @@ endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GLib - FOUND_VAR GLib_FOUND REQUIRED_VARS GLib_LIBRARY - VERSION_VAR GLib_VERSION -) \ No newline at end of file + VERSION_VAR GLib_VERSION) \ No newline at end of file diff --git a/cmake/FindGModule.cmake b/cmake/FindGModule.cmake index 61233145..efdafd4d 100644 --- a/cmake/FindGModule.cmake +++ b/cmake/FindGModule.cmake @@ -8,13 +8,12 @@ find_pkg_config_with_fallback(GModule ) if(GModule_FOUND AND NOT GModule_VERSION) - find_package(GLib) + # TODO + find_package(GLib ${GLib_GLOBAL_VERSION}) set(GModule_VERSION ${GLib_VERSION}) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GModule - FOUND_VAR GModule_FOUND REQUIRED_VARS GModule_LIBRARY - VERSION_VAR GModule_VERSION -) \ No newline at end of file + VERSION_VAR GModule_VERSION) \ No newline at end of file diff --git a/cmake/FindGObject.cmake b/cmake/FindGObject.cmake index 22327469..be1d9b68 100644 --- a/cmake/FindGObject.cmake +++ b/cmake/FindGObject.cmake @@ -8,13 +8,12 @@ find_pkg_config_with_fallback(GObject ) if(GObject_FOUND AND NOT GObject_VERSION) - find_package(GLib) + # TODO + find_package(GLib ${GLib_GLOBAL_VERSION}) set(GObject_VERSION ${GLib_VERSION}) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GObject - FOUND_VAR GObject_FOUND REQUIRED_VARS GObject_LIBRARY - VERSION_VAR GObject_VERSION -) \ No newline at end of file + VERSION_VAR GObject_VERSION) \ No newline at end of file diff --git a/cmake/FindGPGME.cmake b/cmake/FindGPGME.cmake index 1bfefb95..2ab06d8c 100644 --- a/cmake/FindGPGME.cmake +++ b/cmake/FindGPGME.cmake @@ -39,10 +39,12 @@ if(GPGME_CONFIG_EXECUTABLE) OUTPUT_STRIP_TRAILING_WHITESPACE) gpgme_config_fail(${ERRCODE}) - string(REGEX REPLACE "^(.* |)-l([^ ]*gpgme[^ ]*)( .*|)$" "\\2" GPGME_LIBRARY "${GPGME_LDFLAGS}") + string(REGEX REPLACE "^(.* |)-l([^ ]*gpgme[^ ]*)( .*|)$" "\\2" GPGME_LIBRARY_NAME "${GPGME_LDFLAGS}") string(REGEX REPLACE "^(.* |)-L([^ ]*)( .*|)$" "\\2" GPGME_LIBRARY_DIRS "${GPGME_LDFLAGS}") - find_library(LIB_NAME_GPGME ${GPGME_LIBRARY} HINTS ${GPGME_LIBRARY_DIRS}) - set(GPGME_LIBRARY ${LIB_NAME_GPGME}) + find_library(GPGME_LIBRARY ${GPGME_LIBRARY_NAME} HINTS ${GPGME_LIBRARY_DIRS}) + mark_as_advanced(GPGME_LIBRARY) + unset(GPGME_LIBRARY_NAME) + unset(GPGME_LIBRARY_DIRS) if(NOT TARGET gpgme) add_library(gpgme INTERFACE IMPORTED) @@ -54,4 +56,4 @@ endif(GPGME_CONFIG_EXECUTABLE) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GPGME REQUIRED_VARS GPGME_LIBRARY - VERSION_VAR GPGME_VERSION) \ No newline at end of file + VERSION_VAR GPGME_VERSION) diff --git a/cmake/FindGTK3.cmake b/cmake/FindGTK3.cmake index f70c23c2..d80c1730 100644 --- a/cmake/FindGTK3.cmake +++ b/cmake/FindGTK3.cmake @@ -8,14 +8,15 @@ find_pkg_config_with_fallback(GTK3 ) if(GTK3_FOUND AND NOT GTK3_VERSION) - find_path(GTK3_INCLUDE_DIR "gtk/gtk.h" HINTS ${GTK3_INCLUDE_DIRS}) + find_file(GTK3_VERSION_HEADER "gtk/gtkversion.h" HINTS ${GTK3_INCLUDE_DIRS}) + mark_as_advanced(GTK3_VERSION_HEADER) - if(GTK3_INCLUDE_DIR) - file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MAJOR_VERSION REGEX "^#define GTK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") + if(GTK3_VERSION_HEADER) + file(STRINGS "${GTK3_VERSION_HEADER}" GTK3_MAJOR_VERSION REGEX "^#define GTK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define GTK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK3_MAJOR_VERSION "${GTK3_MAJOR_VERSION}") - file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MINOR_VERSION REGEX "^#define GTK_MINOR_VERSION +\\(?([0-9]+)\\)?$") + file(STRINGS "${GTK3_VERSION_HEADER}" GTK3_MINOR_VERSION REGEX "^#define GTK_MINOR_VERSION +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define GTK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK3_MINOR_VERSION "${GTK3_MINOR_VERSION}") - file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MICRO_VERSION REGEX "^#define GTK_MICRO_VERSION +\\(?([0-9]+)\\)?$") + file(STRINGS "${GTK3_VERSION_HEADER}" GTK3_MICRO_VERSION REGEX "^#define GTK_MICRO_VERSION +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define GTK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK3_MICRO_VERSION "${GTK3_MICRO_VERSION}") set(GTK3_VERSION "${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_MICRO_VERSION}") unset(GTK3_MAJOR_VERSION) @@ -26,7 +27,5 @@ endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GTK3 - FOUND_VAR GTK3_FOUND REQUIRED_VARS GTK3_LIBRARY - VERSION_VAR GTK3_VERSION -) \ No newline at end of file + VERSION_VAR GTK3_VERSION) diff --git a/cmake/FindGee.cmake b/cmake/FindGee.cmake index 32232d52..a8000f55 100644 --- a/cmake/FindGee.cmake +++ b/cmake/FindGee.cmake @@ -9,7 +9,5 @@ find_pkg_config_with_fallback(Gee include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Gee - FOUND_VAR Gee_FOUND REQUIRED_VARS Gee_LIBRARY - VERSION_VAR Gee_VERSION -) \ No newline at end of file + VERSION_VAR Gee_VERSION) \ No newline at end of file diff --git a/cmake/FindGettext.cmake b/cmake/FindGettext.cmake index 7d2d260c..f97490ed 100644 --- a/cmake/FindGettext.cmake +++ b/cmake/FindGettext.cmake @@ -2,17 +2,19 @@ find_program(XGETTEXT_EXECUTABLE xgettext) find_program(MSGMERGE_EXECUTABLE msgmerge) find_program(MSGFMT_EXECUTABLE msgfmt) find_program(MSGCAT_EXECUTABLE msgcat) +mark_as_advanced(XGETTEXT_EXECUTABLE MSGMERGE_EXECUTABLE MSGFMT_EXECUTABLE MSGCAT_EXECUTABLE) if(XGETTEXT_EXECUTABLE) execute_process(COMMAND ${XGETTEXT_EXECUTABLE} "--version" - OUTPUT_VARIABLE GETTEXT_VERSION + OUTPUT_VARIABLE Gettext_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "xgettext \\(GNU gettext-tools\\) ([0-9\\.]*).*" "\\1" GETTEXT_VERSION "${GETTEXT_VERSION}") + string(REGEX REPLACE "xgettext \\(GNU gettext-tools\\) ([0-9\\.]*).*" "\\1" Gettext_VERSION "${Gettext_VERSION}") endif(XGETTEXT_EXECUTABLE) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Gettext + FOUND_VAR Gettext_FOUND REQUIRED_VARS XGETTEXT_EXECUTABLE MSGMERGE_EXECUTABLE MSGFMT_EXECUTABLE MSGCAT_EXECUTABLE - VERSION_VAR GETTEXT_VERSION) + VERSION_VAR Gettext_VERSION) set(GETTEXT_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseGettext.cmake") \ No newline at end of file diff --git a/cmake/FindLibnotify.cmake b/cmake/FindLibnotify.cmake index 468ef0c9..61eae949 100644 --- a/cmake/FindLibnotify.cmake +++ b/cmake/FindLibnotify.cmake @@ -7,14 +7,15 @@ find_pkg_config_with_fallback(Libnotify ) if(Libnotify_FOUND AND NOT Libnotify_VERSION) - find_path(Libnotify_INCLUDE_DIR "libnotify/notify-features.h" HINTS ${Libnotify_INCLUDE_DIRS}) + find_file(Libnotify_FEATURES_HEADER "libnotify/notify-features.h" HINTS ${Libnotify_INCLUDE_DIRS}) + mark_as_advanced(Libnotify_FEATURES_HEADER) - if(Libnotify_INCLUDE_DIR) - file(STRINGS "${Libnotify_INCLUDE_DIR}/libnotify/notify-features.h" Libnotify_MAJOR_VERSION REGEX "^#define NOTIFY_VERSION_MAJOR +\\(?([0-9]+)\\)?$") + if(Libnotify_FEATURES_HEADER) + file(STRINGS "${Libnotify_FEATURES_HEADER}" Libnotify_MAJOR_VERSION REGEX "^#define NOTIFY_VERSION_MAJOR +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define NOTIFY_VERSION_MAJOR +\\(?([0-9]+)\\)?$" "\\1" Libnotify_MAJOR_VERSION "${Libnotify_MAJOR_VERSION}") - file(STRINGS "${Libnotify_INCLUDE_DIR}/libnotify/notify-features.h" Libnotify_MINOR_VERSION REGEX "^#define NOTIFY_VERSION_MINOR +\\(?([0-9]+)\\)?$") + file(STRINGS "${Libnotify_FEATURES_HEADER}" Libnotify_MINOR_VERSION REGEX "^#define NOTIFY_VERSION_MINOR +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define NOTIFY_VERSION_MINOR +\\(?([0-9]+)\\)?$" "\\1" Libnotify_MINOR_VERSION "${Libnotify_MINOR_VERSION}") - file(STRINGS "${Libnotify_INCLUDE_DIR}/libnotify/notify-features.h" Libnotify_MICRO_VERSION REGEX "^#define NOTIFY_VERSION_MICRO +\\(?([0-9]+)\\)?$") + file(STRINGS "${Libnotify_FEATURES_HEADER}" Libnotify_MICRO_VERSION REGEX "^#define NOTIFY_VERSION_MICRO +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define NOTIFY_VERSION_MICRO +\\(?([0-9]+)\\)?$" "\\1" Libnotify_MICRO_VERSION "${Libnotify_MICRO_VERSION}") set(Libnotify_VERSION "${Libnotify_MAJOR_VERSION}.${Libnotify_MINOR_VERSION}.${Libnotify_MICRO_VERSION}") unset(Libnotify_MAJOR_VERSION) diff --git a/cmake/FindPango.cmake b/cmake/FindPango.cmake index b934c6ff..485240d5 100644 --- a/cmake/FindPango.cmake +++ b/cmake/FindPango.cmake @@ -8,14 +8,15 @@ find_pkg_config_with_fallback(Pango ) if(Pango_FOUND AND NOT Pango_VERSION) - find_path(Pango_INCLUDE_DIR "pango/pango.h" HINTS ${Pango_INCLUDE_DIRS}) + find_file(Pango_FEATURES_HEADER "pango/pango-features.h" HINTS ${Pango_INCLUDE_DIRS}) + mark_as_advanced(Pango_FEATURES_HEADER) - if(Pango_INCLUDE_DIR) - file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MAJOR_VERSION REGEX "^#define PANGO_VERSION_MAJOR +\\(?([0-9]+)\\)?$") + if(Pango_FEATURES_HEADER) + file(STRINGS "${Pango_FEATURES_HEADER}" Pango_MAJOR_VERSION REGEX "^#define PANGO_VERSION_MAJOR +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define PANGO_VERSION_MAJOR \\(?([0-9]+)\\)?$" "\\1" Pango_MAJOR_VERSION "${Pango_MAJOR_VERSION}") - file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MINOR_VERSION REGEX "^#define PANGO_VERSION_MINOR +\\(?([0-9]+)\\)?$") + file(STRINGS "${Pango_FEATURES_HEADER}" Pango_MINOR_VERSION REGEX "^#define PANGO_VERSION_MINOR +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define PANGO_VERSION_MINOR \\(?([0-9]+)\\)?$" "\\1" Pango_MINOR_VERSION "${Pango_MINOR_VERSION}") - file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MICRO_VERSION REGEX "^#define PANGO_VERSION_MICRO +\\(?([0-9]+)\\)?$") + file(STRINGS "${Pango_FEATURES_HEADER}" Pango_MICRO_VERSION REGEX "^#define PANGO_VERSION_MICRO +\\(?([0-9]+)\\)?$") string(REGEX REPLACE "^#define PANGO_VERSION_MICRO \\(?([0-9]+)\\)?$" "\\1" Pango_MICRO_VERSION "${Pango_MICRO_VERSION}") set(Pango_VERSION "${Pango_MAJOR_VERSION}.${Pango_MINOR_VERSION}.${Pango_MICRO_VERSION}") unset(Pango_MAJOR_VERSION) diff --git a/cmake/FindSQLite3.cmake b/cmake/FindSQLite3.cmake index bf258997..9bb05def 100644 --- a/cmake/FindSQLite3.cmake +++ b/cmake/FindSQLite3.cmake @@ -6,17 +6,16 @@ find_pkg_config_with_fallback(SQLite3 ) if(SQLite3_FOUND AND NOT SQLite3_VERSION) - find_path(SQLite3_INCLUDE_DIR "sqlite3.h" HINTS ${SQLite3_INCLUDE_DIRS}) + find_file(SQLite3_HEADER "sqlite3.h" HINTS ${SQLite3_INCLUDE_DIRS}) + mark_as_advanced(SQLite3_HEADER) - if(SQLite3_INCLUDE_DIR) - file(STRINGS "${SQLite3_INCLUDE_DIR}/sqlite3.h" SQLite3_VERSION REGEX "^#define SQLITE_VERSION +\\\"[^\\\"]+\\\"") + if(SQLite3_HEADER) + file(STRINGS "${SQLite3_HEADER}" SQLite3_VERSION REGEX "^#define SQLITE_VERSION +\\\"[^\\\"]+\\\"") string(REGEX REPLACE "^#define SQLITE_VERSION +\\\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\\\"$" "\\1.\\2.\\3" SQLite3_VERSION "${SQLite3_VERSION}") endif() endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(SQLite3 - FOUND_VAR SQLite3_FOUND REQUIRED_VARS SQLite3_LIBRARY - VERSION_VAR SQLite3_VERSION -) \ No newline at end of file + VERSION_VAR SQLite3_VERSION) \ No newline at end of file diff --git a/cmake/FindSignalProtocol.cmake b/cmake/FindSignalProtocol.cmake new file mode 100644 index 00000000..75583e6a --- /dev/null +++ b/cmake/FindSignalProtocol.cmake @@ -0,0 +1,10 @@ +include(PkgConfigWithFallback) +find_pkg_config_with_fallback(SignalProtocol + PKG_CONFIG_NAME signal-protocol-c + LIB_NAMES signal-protocol-c + INCLUDE_NAMES signal/signal_protocol.h +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(SignalProtocol + REQUIRED_VARS SignalProtocol_LIBRARY) \ No newline at end of file diff --git a/cmake/FindVala.cmake b/cmake/FindVala.cmake index ae87de17..f9ed7636 100644 --- a/cmake/FindVala.cmake +++ b/cmake/FindVala.cmake @@ -65,6 +65,7 @@ endif(VALA_EXECUTABLE) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Vala + FOUND_VAR VALA_FOUND REQUIRED_VARS VALA_EXECUTABLE VERSION_VAR VALA_VERSION) diff --git a/cmake/PkgConfigWithFallback.cmake b/cmake/PkgConfigWithFallback.cmake index 988e4564..ea14fa23 100644 --- a/cmake/PkgConfigWithFallback.cmake +++ b/cmake/PkgConfigWithFallback.cmake @@ -15,15 +15,16 @@ function(find_pkg_config_with_fallback name) # Try to find real file name of libraries foreach(lib ${${name}_PKG_CONFIG_LIBRARIES}) - find_library(LIB_NAME_${lib} ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS}) - if(NOT LIB_NAME_${lib}) + find_library(${name}_${lib}_LIBRARY ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS}) + mark_as_advanced(${name}_${lib}_LIBRARY) + if(NOT ${name}_${lib}_LIBRARY) unset(${name}_FOUND) - endif(NOT LIB_NAME_${lib}) + endif(NOT ${name}_${lib}_LIBRARY) endforeach(lib) if(${name}_FOUND) set(${name}_LIBRARIES "") foreach(lib ${${name}_PKG_CONFIG_LIBRARIES}) - list(APPEND ${name}_LIBRARIES ${LIB_NAME_${lib}}) + list(APPEND ${name}_LIBRARIES ${${name}_${lib}_LIBRARY}) endforeach(lib) list(REMOVE_DUPLICATES ${name}_LIBRARIES) set(${name}_LIBRARIES ${${name}_LIBRARIES} PARENT_SCOPE) @@ -46,34 +47,36 @@ function(find_pkg_config_with_fallback name) # No success with pkg-config, try via find_library on all lib_names set(${name}_FOUND "1") foreach(lib ${ARGS_LIB_NAMES}) - find_library(LIB_NAME_${lib} ${ARGS_LIB_NAMES} HINTS ${ARGS_LIB_DIR_HINTS}) + find_library(${name}_${lib}_LIBRARY ${ARGS_LIB_NAMES} HINTS ${ARGS_LIB_DIR_HINTS}) + mark_as_advanced(${name}_${lib}_LIBRARY) - if(NOT LIB_NAME_${lib}) + if(NOT ${name}_${lib}_LIBRARY) unset(${name}_FOUND) - endif(NOT LIB_NAME_${lib}) + endif(NOT ${name}_${lib}_LIBRARY) endforeach(lib) foreach(inc ${ARGS_INCLUDE_NAMES}) - find_path(INCLUDE_PATH_${inc} ${inc} HINTS ${ARGS_INCLUDE_DIR_HINTS} PATHS ${ARGS_INCLUDE_DIR_PATHS} PATH_SUFFIXES ${ARGS_INCLUDE_DIR_SUFFIXES}) + find_path(${name}_${inc}_INCLUDE_PATH ${inc} HINTS ${ARGS_INCLUDE_DIR_HINTS} PATHS ${ARGS_INCLUDE_DIR_PATHS} PATH_SUFFIXES ${ARGS_INCLUDE_DIR_SUFFIXES}) + mark_as_advanced(${name}_${inc}_INCLUDE_PATH) - if(NOT INCLUDE_PATH_${inc}) + if(NOT ${name}_${inc}_INCLUDE_PATH) unset(${name}_FOUND) - endif(NOT INCLUDE_PATH_${inc}) + endif(NOT ${name}_${inc}_INCLUDE_PATH) endforeach(inc) if(${name}_FOUND) set(${name}_LIBRARIES "") set(${name}_INCLUDE_DIRS "") foreach(lib ${ARGS_LIB_NAMES}) - list(APPEND ${name}_LIBRARIES ${LIB_NAME_${lib}}) + list(APPEND ${name}_LIBRARIES ${${name}_${lib}_LIBRARY}) endforeach(lib) foreach(inc ${ARGS_INCLUDE_NAMES}) - list(APPEND ${name}_INCLUDE_DIRS ${INCLUDE_PATH_${inc}}) + list(APPEND ${name}_INCLUDE_DIRS ${${name}_${inc}_INCLUDE_PATH}) endforeach(inc) list(GET ${name}_LIBRARIES "0" ${name}_LIBRARY) foreach(dep ${ARGS_DEPENDS}) - find_package(${dep} QUIET) + find_package(${dep} ${${dep}_GLOBAL_VERSION} QUIET) if(${dep}_FOUND) list(APPEND ${name}_INCLUDE_DIRS ${${dep}_INCLUDE_DIRS}) @@ -96,4 +99,4 @@ function(find_pkg_config_with_fallback name) endif(NOT TARGET ${ARGS_PKG_CONFIG_NAME}) endif(${name}_FOUND) endif(${name}_PKG_CONFIG_FOUND) -endfunction() \ No newline at end of file +endfunction() -- cgit v1.2.3-70-g09d2