diff options
author | louiz’ <louiz@louiz.org> | 2017-03-12 16:51:19 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-03-12 16:51:19 +0100 |
commit | a6f6e36594979a83ad16b3c4de350ed95e79daf3 (patch) | |
tree | 3c54529585011ebd3696c5fa7f60be541f96bcac /louloulibs | |
parent | 4d42dddf465f22af795456056b64863e19f16e8e (diff) | |
download | biboumi-a6f6e36594979a83ad16b3c4de350ed95e79daf3.tar.gz biboumi-a6f6e36594979a83ad16b3c4de350ed95e79daf3.tar.bz2 biboumi-a6f6e36594979a83ad16b3c4de350ed95e79daf3.tar.xz biboumi-a6f6e36594979a83ad16b3c4de350ed95e79daf3.zip |
cmake: Improve the usage of PARENT_SCOPE
Diffstat (limited to 'louloulibs')
-rw-r--r-- | louloulibs/CMakeLists.txt | 40 | ||||
-rw-r--r-- | louloulibs/cmake/Modules/FindBOTAN.cmake | 33 | ||||
-rw-r--r-- | louloulibs/cmake/Modules/FindGCRYPT.cmake | 30 | ||||
-rw-r--r-- | louloulibs/cmake/Modules/FindICONV.cmake | 9 | ||||
-rw-r--r-- | louloulibs/cmake/Modules/FindLIBIDN.cmake | 7 | ||||
-rw-r--r-- | louloulibs/cmake/Modules/FindLIBUUID.cmake | 5 | ||||
-rw-r--r-- | louloulibs/cmake/Modules/FindSYSTEMD.cmake | 7 | ||||
-rw-r--r-- | louloulibs/cmake/Modules/FindUDNS.cmake | 5 |
8 files changed, 60 insertions, 76 deletions
diff --git a/louloulibs/CMakeLists.txt b/louloulibs/CMakeLists.txt index e1e402f..80b1f5f 100644 --- a/louloulibs/CMakeLists.txt +++ b/louloulibs/CMakeLists.txt @@ -10,10 +10,10 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -pedantic -Wall -Wextra") ## Look for external libraries # set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") -include(FindEXPAT) -find_package(EXPAT REQUIRED) find_package(ICONV REQUIRED) find_package(LIBUUID REQUIRED) +find_package(EXPAT REQUIRED) +set(EXPAT_FOUND ${EXPAT_FOUND} PARENT_SCOPE) if(WITH_LIBIDN) find_package(LIBIDN REQUIRED) @@ -50,42 +50,6 @@ include_directories(${EXPAT_INCLUDE_DIRS}) include_directories(${ICONV_INCLUDE_DIRS}) include_directories(${LIBUUID_INCLUDE_DIRS}) -set(EXPAT_INCLUDE_DIRS ${EXPAT_INCLUDE_DIRS} PARENT_SCOPE) -set(EXPAT_LIBRARIES ${EXPAT_LIBRARIES} PARENT_SCOPE) -set(ICONV_INCLUDE_DIRS ${ICONV_INCLUDE_DIRS} PARENT_SCOPE) -set(ICONV_LIBRARIES ${ICONV_LIBRARIES} PARENT_SCOPE) -set(LIBUUID_INCLUDE_DIRS ${LIBUUID_INCLUDE_DIRS} PARENT_SCOPE) -set(LIBUUID_LIBRARIES ${LIBUUID_LIBRARIES} PARENT_SCOPE) - -if(LIBIDN_FOUND) - include_directories(${LIBIDN_INCLUDE_DIRS}) - set(LIBDIN_FOUND ${LIBDIN_FOUND} PARENT_SCOPE) - set(LIBDIN_INCLUDE_DIRS ${LIBDIN_INCLUDE_DIRS} PARENT_SCOPE) -endif() - -if(SYSTEMD_FOUND) - include_directories(${SYSTEMD_INCLUDE_DIRS}) - set(SYSTEMD_FOUND ${SYSTEMD_FOUND} PARENT_SCOPE) - set(SYSTEMD_INCLUDE_DIRS ${SYSTEMD_INCLUDE_DIRS} PARENT_SCOPE) -endif() - -if(BOTAN_FOUND) - include_directories(SYSTEM ${BOTAN_INCLUDE_DIRS}) - set(BOTAN_FOUND ${BOTAN_FOUND} PARENT_SCOPE) - set(BOTAN_INCLUDE_DIRS ${BOTAN_INCLUDE_DIRS} PARENT_SCOPE) -endif() -if(GCRYPT_FOUND) - include_directories(SYSTEM ${GCRYPT_INCLUDE_DIRS}) - set(GCRYPT_FOUND ${GCRYPT_FOUND} PARENT_SCOPE) - set(GCRYPT_INCLUDE_DIRS ${GCRYPT_INCLUDE_DIRS} PARENT_SCOPE) -endif() - -if(UDNS_FOUND) - include_directories(${UDNS_INCLUDE_DIRS}) - set(UDNS_FOUND ${UDNS_FOUND} PARENT_SCOPE) - set(UDNS_INCLUDE_DIRS ${UDNS_INCLUDE_DIRS} PARENT_SCOPE) -endif() - set(POLLER_DOCSTRING "Choose the poller between POLL and EPOLL (Linux-only)") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(POLLER "EPOLL" CACHE STRING ${POLLER_DOCSTRING}) 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() |