diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2018-11-26 16:32:06 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2018-12-01 16:56:23 (GMT) |
commit | f266182aecb687f0c20c7fa7019ad0dde3222f46 (patch) | |
tree | 329ec6152a0290856004f3ac263c71acc740a4b3 /Modules/CheckLibraryExists.cmake | |
parent | 29f9db5c63dbfa53acdb449fad78d716a4113a88 (diff) | |
download | CMake-f266182aecb687f0c20c7fa7019ad0dde3222f46.zip CMake-f266182aecb687f0c20c7fa7019ad0dde3222f46.tar.gz CMake-f266182aecb687f0c20c7fa7019ad0dde3222f46.tar.bz2 |
Check* functions family: add support for LINK_OPTIONS
Fixes: #18521
Diffstat (limited to 'Modules/CheckLibraryExists.cmake')
-rw-r--r-- | Modules/CheckLibraryExists.cmake | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index 428a6b0..6504df5 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -7,15 +7,19 @@ CheckLibraryExists Check if the function exists. -CHECK_LIBRARY_EXISTS (LIBRARY FUNCTION LOCATION VARIABLE) +.. command:: CHECK_LIBRARY_EXISTS -:: + .. code-block:: cmake + + CHECK_LIBRARY_EXISTS(LIBRARY FUNCTION LOCATION VARIABLE) - LIBRARY - the name of the library you are looking for - FUNCTION - the name of the function - LOCATION - location where the library should be found - VARIABLE - variable to store the result - Will be created as an internal cache variable. + :: + + LIBRARY - the name of the library you are looking for + FUNCTION - the name of the function + LOCATION - location where the library should be found + VARIABLE - variable to store the result + Will be created as an internal cache variable. @@ -26,6 +30,7 @@ the way the check is run: CMAKE_REQUIRED_FLAGS = string of compile command line flags CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) + CMAKE_REQUIRED_LINK_OPTIONS = list of options to pass to link command CMAKE_REQUIRED_LIBRARIES = list of libraries to link CMAKE_REQUIRED_QUIET = execute quietly without messages #]=======================================================================] @@ -39,6 +44,11 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) if(NOT CMAKE_REQUIRED_QUIET) message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") endif() + set(CHECK_LIBRARY_EXISTS_LINK_OPTIONS) + if(CMAKE_REQUIRED_LINK_OPTIONS) + set(CHECK_LIBRARY_EXISTS_LINK_OPTIONS + LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS}) + endif() set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY}) if(CMAKE_REQUIRED_LIBRARIES) set(CHECK_LIBRARY_EXISTS_LIBRARIES @@ -58,6 +68,7 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) ${CMAKE_BINARY_DIR} ${_cle_source} COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_LIBRARY_EXISTS_LINK_OPTIONS} LINK_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION} |