From a6f6e36594979a83ad16b3c4de350ed95e79daf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 12 Mar 2017 16:51:19 +0100 Subject: cmake: Improve the usage of PARENT_SCOPE --- louloulibs/cmake/Modules/FindBOTAN.cmake | 33 +++++++++++++++++++----------- louloulibs/cmake/Modules/FindGCRYPT.cmake | 30 ++++++++++++++++----------- louloulibs/cmake/Modules/FindICONV.cmake | 9 ++++---- louloulibs/cmake/Modules/FindLIBIDN.cmake | 7 ++++--- louloulibs/cmake/Modules/FindLIBUUID.cmake | 5 +++-- louloulibs/cmake/Modules/FindSYSTEMD.cmake | 7 ++++--- louloulibs/cmake/Modules/FindUDNS.cmake | 5 +++-- 7 files changed, 58 insertions(+), 38 deletions(-) (limited to 'louloulibs/cmake/Modules') diff --git a/louloulibs/cmake/Modules/FindBOTAN.cmake b/louloulibs/cmake/Modules/FindBOTAN.cmake index 26069f4..27f82a7 100644 --- a/louloulibs/cmake/Modules/FindBOTAN.cmake +++ b/louloulibs/cmake/Modules/FindBOTAN.cmake @@ -15,21 +15,30 @@ # # This file is in the public domain -find_path(BOTAN_INCLUDE_DIRS NAMES botan/botan.h - PATH_SUFFIXES botan-2 botan-1.11 - DOC "The botan include directory") +include(FindPkgConfig) +pkg_check_modules(BOTAN botan-2) +if(NOT BOTAN_FOUND) + pkg_check_modules(BOTAN botan-1.11) +endif() + +if(NOT BOTAN_FOUND) + find_path(BOTAN_INCLUDE_DIRS NAMES botan/botan.h + PATH_SUFFIXES botan-2 botan-1.11 + DOC "The botan include directory") -find_library(BOTAN_LIBRARIES NAMES botan botan-2 botan-1.11 - DOC "The botan library") + find_library(BOTAN_LIBRARIES NAMES botan botan-2 botan-1.11 + DOC "The botan library") -# Use some standard module to handle the QUIETLY and REQUIRED arguments, and -# set BOTAN_FOUND to TRUE if these two variables are set. -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(BOTAN REQUIRED_VARS BOTAN_LIBRARIES BOTAN_INCLUDE_DIRS) + # Use some standard module to handle the QUIETLY and REQUIRED arguments, and + # set BOTAN_FOUND to TRUE if these two variables are set. + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(BOTAN REQUIRED_VARS BOTAN_LIBRARIES BOTAN_INCLUDE_DIRS) -if(BOTAN_FOUND) - set(BOTAN_LIBRARY ${BOTAN_LIBRARIES}) - set(BOTAN_INCLUDE_DIR ${BOTAN_INCLUDE_DIRS}) + if(BOTAN_FOUND) + set(BOTAN_LIBRARY ${BOTAN_LIBRARIES} PARENT_SCOPE) + set(BOTAN_INCLUDE_DIR ${BOTAN_INCLUDE_DIRS} PARENT_SCOPE) + set(BOTAN_FOUND ${BOTAN_FOUND} PARENT_SCOPE) + endif() endif() mark_as_advanced(BOTAN_INCLUDE_DIRS BOTAN_LIBRARIES) diff --git a/louloulibs/cmake/Modules/FindGCRYPT.cmake b/louloulibs/cmake/Modules/FindGCRYPT.cmake index bb1bc67..62f5c7a 100644 --- a/louloulibs/cmake/Modules/FindGCRYPT.cmake +++ b/louloulibs/cmake/Modules/FindGCRYPT.cmake @@ -15,21 +15,27 @@ # # This file is in the public domain -find_path(GCRYPT_INCLUDE_DIRS NAMES gcrypt.h - PATH_SUFFIXES gcrypt - DOC "The gcrypt include directory") +include(FindPkgConfig) +pkg_check_modules(GCRYPT gcrypt) -find_library(GCRYPT_LIBRARIES NAMES gcrypt - DOC "The gcrypt library") +if(NOT GCRYPT_FOUND) + find_path(GCRYPT_INCLUDE_DIRS NAMES gcrypt.h + PATH_SUFFIXES gcrypt + DOC "The gcrypt include directory") -# Use some standard module to handle the QUIETLY and REQUIRED arguments, and -# set GCRYPT_FOUND to TRUE if these two variables are set. -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GCRYPT REQUIRED_VARS GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIRS) + find_library(GCRYPT_LIBRARIES NAMES gcrypt + DOC "The gcrypt library") -if(GCRYPT_FOUND) - set(GCRYPT_LIBRARY ${GCRYPT_LIBRARIES}) - set(GCRYPT_INCLUDE_DIR ${GCRYPT_INCLUDE_DIRS}) + # Use some standard module to handle the QUIETLY and REQUIRED arguments, and + # set GCRYPT_FOUND to TRUE if these two variables are set. + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(GCRYPT REQUIRED_VARS GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIRS) + + if(GCRYPT_FOUND) + set(GCRYPT_LIBRARY ${GCRYPT_LIBRARIES} PARENT_SCOPE) + set(GCRYPT_INCLUDE_DIR ${GCRYPT_INCLUDE_DIRS} PARENT_SCOPE) + set(GCRYPT_FOUND ${GCRYPT_FOUND} PARENT_SCOPE) + endif() endif() mark_as_advanced(GCRYPT_INCLUDE_DIRS GCRYPT_LIBRARIES) diff --git a/louloulibs/cmake/Modules/FindICONV.cmake b/louloulibs/cmake/Modules/FindICONV.cmake index 7ca173f..9e5bde6 100644 --- a/louloulibs/cmake/Modules/FindICONV.cmake +++ b/louloulibs/cmake/Modules/FindICONV.cmake @@ -52,9 +52,10 @@ if(ICONV_FOUND) return 0;}" ICONV_SECOND_ARGUMENT_IS_CONST) -# Compatibility for all the ways of writing these variables - set(ICONV_LIBRARY ${ICONV_LIBRARIES}) - set(ICONV_INCLUDE_DIR ${ICONV_INCLUDE_DIRS}) + # Compatibility for all the ways of writing these variables + set(ICONV_LIBRARY ${ICONV_LIBRARIES} PARENT_SCOPE) + set(ICONV_INCLUDE_DIR ${ICONV_INCLUDE_DIRS} PARENT_SCOPE) + set(ICONV_FOUND ${ICONV_FOUND} PARENT_SCOPE) endif() -mark_as_advanced(ICONV_INCLUDE_DIRS ICONV_LIBRARIES ICONV_SECOND_ARGUMENT_IS_CONST) \ No newline at end of file +mark_as_advanced(ICONV_INCLUDE_DIRS ICONV_LIBRARIES ICONV_SECOND_ARGUMENT_IS_CONST) diff --git a/louloulibs/cmake/Modules/FindLIBIDN.cmake b/louloulibs/cmake/Modules/FindLIBIDN.cmake index 611a6a8..716714f 100644 --- a/louloulibs/cmake/Modules/FindLIBIDN.cmake +++ b/louloulibs/cmake/Modules/FindLIBIDN.cmake @@ -33,9 +33,10 @@ if(NOT LIBIDN_FOUND) # Compatibility for all the ways of writing these variables if(LIBIDN_FOUND) - set(LIBIDN_INCLUDE_DIR ${LIBIDN_INCLUDE_DIRS}) - set(LIBIDN_LIBRARY ${LIBIDN_LIBRARIES}) + set(LIBIDN_INCLUDE_DIR ${LIBIDN_INCLUDE_DIRS} PARENT_SCOPE) + set(LIBIDN_LIBRARY ${LIBIDN_LIBRARIES} PARENT_SCOPE) + set(LIBIDN_FOUND ${LIBIDN_FOUND} PARENT_SCOPE) endif() endif() -mark_as_advanced(LIBIDN_INCLUDE_DIRS LIBIDN_LIBRARIES) \ No newline at end of file +mark_as_advanced(LIBIDN_INCLUDE_DIRS LIBIDN_LIBRARIES) diff --git a/louloulibs/cmake/Modules/FindLIBUUID.cmake b/louloulibs/cmake/Modules/FindLIBUUID.cmake index f344249..9269978 100644 --- a/louloulibs/cmake/Modules/FindLIBUUID.cmake +++ b/louloulibs/cmake/Modules/FindLIBUUID.cmake @@ -33,8 +33,9 @@ if(NOT LIBUUID_FOUND) # Compatibility for all the ways of writing these variables if(LIBUUID_FOUND) - set(LIBUUID_INCLUDE_DIR ${LIBUUID_INCLUDE_DIRS}) - set(LIBUUID_LIBRARY ${LIBUUID_LIBRARIES}) + set(LIBUUID_INCLUDE_DIR ${LIBUUID_INCLUDE_DIRS} PARENT_SCOPE) + set(LIBUUID_LIBRARY ${LIBUUID_LIBRARIES} PARENT_SCOPE) + set(LIBUUID_FOUND ${LIBUUID_FOUND} PARENT_SCOPE) endif() endif() diff --git a/louloulibs/cmake/Modules/FindSYSTEMD.cmake b/louloulibs/cmake/Modules/FindSYSTEMD.cmake index c7decde..43db6c4 100644 --- a/louloulibs/cmake/Modules/FindSYSTEMD.cmake +++ b/louloulibs/cmake/Modules/FindSYSTEMD.cmake @@ -31,9 +31,10 @@ if(NOT SYSTEMD_FOUND) find_package_handle_standard_args(SYSTEMD REQUIRED_VARS SYSTEMD_LIBRARIES SYSTEMD_INCLUDE_DIRS) if(SYSTEMD_FOUND) - set(SYSTEMD_LIBRARY ${SYSTEMD_LIBRARIES}) - set(SYSTEMD_INCLUDE_DIR ${SYSTEMD_INCLUDE_DIRS}) + set(SYSTEMD_LIBRARY ${SYSTEMD_LIBRARIES} PARENT_SCOPE) + set(SYSTEMD_INCLUDE_DIR ${SYSTEMD_INCLUDE_DIRS} PARENT_SCOPE) + set(SYSTEMD_FOUND ${SYSTEMD_FOUND} PARENT_SCOPE) endif() endif() -mark_as_advanced(SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES) \ No newline at end of file +mark_as_advanced(SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES) diff --git a/louloulibs/cmake/Modules/FindUDNS.cmake b/louloulibs/cmake/Modules/FindUDNS.cmake index 1d32cd3..33fbc4c 100644 --- a/louloulibs/cmake/Modules/FindUDNS.cmake +++ b/louloulibs/cmake/Modules/FindUDNS.cmake @@ -29,8 +29,9 @@ if(NOT UDNS_FOUND) # Compatibility for all the ways of writing these variables if(UDNS_FOUND) - set(UDNS_INCLUDE_DIR ${UDNS_INCLUDE_DIRS}) - set(UDNS_LIBRARY ${UDNS_LIBRARIES}) + set(UDNS_INCLUDE_DIR ${UDNS_INCLUDE_DIRS} PARENT_SCOPE) + set(UDNS_LIBRARY ${UDNS_LIBRARIES} PARENT_SCOPE) + set(UDNS_FOUND ${UDNS_FOUND} PARENT_SCOPE) endif() endif() -- cgit v1.2.3