cmake: Improve the usage of PARENT_SCOPE

This commit is contained in:
louiz’
2017-03-12 16:51:19 +01:00
parent 4d42dddf46
commit a6f6e36594
9 changed files with 62 additions and 78 deletions
+21 -12
View File
@@ -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()
find_library(BOTAN_LIBRARIES NAMES botan botan-2 botan-1.11
DOC "The botan library")
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")
# 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)
find_library(BOTAN_LIBRARIES NAMES botan botan-2 botan-1.11
DOC "The botan library")
if(BOTAN_FOUND)
set(BOTAN_LIBRARY ${BOTAN_LIBRARIES})
set(BOTAN_INCLUDE_DIR ${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} 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)
+18 -12
View File
@@ -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)
+5 -4
View File
@@ -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)
mark_as_advanced(ICONV_INCLUDE_DIRS ICONV_LIBRARIES ICONV_SECOND_ARGUMENT_IS_CONST)
+4 -3
View File
@@ -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)
mark_as_advanced(LIBIDN_INCLUDE_DIRS LIBIDN_LIBRARIES)
+3 -2
View File
@@ -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()
+4 -3
View File
@@ -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)
mark_as_advanced(SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES)
+3 -2
View File
@@ -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()