summaryrefslogtreecommitdiff
path: root/Modules/CheckLibraryExists.cmake
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-01-01 15:02:20 -0500
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-01-01 15:02:20 -0500
commit6d5c4370450fa34afb754ca2fdef79ee71ab9d99 (patch)
tree9b3b0fdfe1fd7e94a2db560a503256198ce9e428 /Modules/CheckLibraryExists.cmake
parentfe6721af84a5ec31f1b185fce1f6024a5d9c7e20 (diff)
downloadcmake-6d5c4370450fa34afb754ca2fdef79ee71ab9d99.tar.gz
Add a way to add custom libraries to the mix
Diffstat (limited to 'Modules/CheckLibraryExists.cmake')
-rw-r--r--Modules/CheckLibraryExists.cmake7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index ea92fab5bb..9eb48af9bc 100644
--- a/Modules/CheckLibraryExists.cmake
+++ b/Modules/CheckLibraryExists.cmake
@@ -10,13 +10,18 @@ MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION -DCHECK_FUNCTION_EXISTS=${FUNCTION})
MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
+ SET(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY})
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_LIBRARY_EXISTS_LIBRARIES
+ ${CHECK_LIBRARY_EXISTS_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES})
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
TRY_COMPILE(${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckFunctionExists.c
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_LIBRARY_EXISTS_DEFINITION}
-DLINK_DIRECTORIES:STRING=${LOCATION}
- -DLINK_LIBRARIES:STRING=${LIBRARY}
+ -DLINK_LIBRARIES:STRING=${CHECK_LIBRARY_EXISTS_LIBRARIES}
OUTPUT_VARIABLE OUTPUT)
IF(${VARIABLE})