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/cmake/Modules/FindGCRYPT.cmake | |
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/cmake/Modules/FindGCRYPT.cmake')
-rw-r--r-- | louloulibs/cmake/Modules/FindGCRYPT.cmake | 30 |
1 files changed, 18 insertions, 12 deletions
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) |