summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-01-01 20:02:20 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-01-01 20:02:20 (GMT)
commit6d5c4370450fa34afb754ca2fdef79ee71ab9d99 (patch)
tree9b3b0fdfe1fd7e94a2db560a503256198ce9e428 /Modules
parentfe6721af84a5ec31f1b185fce1f6024a5d9c7e20 (diff)
downloadCMake-6d5c4370450fa34afb754ca2fdef79ee71ab9d99.zip
CMake-6d5c4370450fa34afb754ca2fdef79ee71ab9d99.tar.gz
CMake-6d5c4370450fa34afb754ca2fdef79ee71ab9d99.tar.bz2
Add a way to add custom libraries to the mix
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CheckFunctionExists.cmake5
-rw-r--r--Modules/CheckLibraryExists.cmake7
-rw-r--r--Modules/CheckTypeSize.cmake5
3 files changed, 16 insertions, 1 deletions
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index 1ab1ad3..0e830f6 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -10,10 +10,15 @@ MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
SET(MACRO_CHECK_FUNCTION_DEFINITIONS -DCHECK_FUNCTION_EXISTS=${FUNCTION})
MESSAGE(STATUS "Looking for ${FUNCTION}")
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${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_FUNCTION_DEFINITIONS}
+ ${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}
OUTPUT_VARIABLE OUTPUT)
IF(${VARIABLE})
SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}")
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index ea92fab..9eb48af 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})
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index 35dcaaa..306f1a1 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -17,10 +17,15 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
SET(MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -DHAVE_STDINT_H")
ENDIF(HAVE_STDINT_H)
MESSAGE(STATUS "Check size of ${TYPE}")
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_TYPE_SIZE_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
TRY_RUN(${VARIABLE} HAVE_${VARIABLE}
${CMAKE_BINARY_DIR}
${CMAKE_ROOT}/Modules/CheckTypeSize.c
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
+ ${CHECK_TYPE_SIZE_ADD_LIBRARIES}
OUTPUT_VARIABLE OUTPUT)
IF(HAVE_${VARIABLE})
MESSAGE(STATUS "Check size of ${TYPE} - done")