Add a way to add custom libraries to the mix

This commit is contained in:
Andy Cedilnik 2003-01-01 15:02:20 -05:00
parent fe6721af84
commit 6d5c437045
3 changed files with 16 additions and 1 deletions

View File

@ -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}")

View File

@ -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})

View File

@ -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")