Commit a6f6e365 authored by louiz’'s avatar louiz’

cmake: Improve the usage of PARENT_SCOPE

parent 4d42dddf
......@@ -193,11 +193,11 @@ add_executable(test_suite EXCLUDE_FROM_ALL ${source_tests}
target_link_libraries(${PROJECT_NAME}
${EXPAT_LIBRARIES}
${LIBUUID_LIBRARIES}
${EXPAT_LIBRARIES})
${EXPAT_LIBRARY})
target_link_libraries(test_suite
${EXPAT_LIBRARIES}
${LIBUUID_LIBRARIES}
${EXPAT_LIBRARIES})
${EXPAT_LIBRARY})
if(SYSTEMD_FOUND)
target_link_libraries(${PROJECT_NAME} ${SYSTEMD_LIBRARIES})
target_link_libraries(test_suite ${SYSTEMD_LIBRARIES})
......
......@@ -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})
......
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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()
......
......@@ -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)
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment