diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CheckFunctionExists.cmake | 36 | ||||
-rw-r--r-- | Modules/CheckIncludeFile.cmake | 40 | ||||
-rw-r--r-- | Modules/CheckLibraryExists.cmake | 44 | ||||
-rw-r--r-- | Modules/CheckSizeOf.cmake | 43 | ||||
-rw-r--r-- | Modules/TestForANSIForScope.cmake | 21 | ||||
-rw-r--r-- | Modules/TestForANSIStreamHeaders.cmake | 23 | ||||
-rw-r--r-- | Modules/TestForSTDNamespace.cmake | 21 |
7 files changed, 127 insertions, 101 deletions
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index bcf274b..2afaa40 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -7,21 +7,23 @@ # MACRO(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) - SET(MACRO_CHECK_FUNCTION_DEFINITIONS -DCHECK_FUNCTION_EXISTS=${FUNCTION}) - MESSAGE(STATUS "Looking for ${FUNCTION}") - TRY_COMPILE(${VARIABLE} - ${PROJECT_BINARY_DIR} - ${CMAKE_ROOT}/Modules/CheckFunctionExists.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - OUTPUT_VARIABLE OUTPUT) - IF(${VARIABLE}) - SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") - MESSAGE(STATUS "Found ${FUNCTION}") - ELSE(${VARIABLE}) - MESSAGE(STATUS "${FUNCTION} not found") - SET(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}") - WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log - "Determining if the function ${FUNCTION} exists failed with the following output:\n" - "${OUTPUT}\n" APPEND) - ENDIF(${VARIABLE}) + IF(NOT ${VARIABLE}) + SET(MACRO_CHECK_FUNCTION_DEFINITIONS -DCHECK_FUNCTION_EXISTS=${FUNCTION}) + MESSAGE(STATUS "Looking for ${FUNCTION}") + TRY_COMPILE(${VARIABLE} + ${PROJECT_BINARY_DIR} + ${CMAKE_ROOT}/Modules/CheckFunctionExists.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + OUTPUT_VARIABLE OUTPUT) + IF(${VARIABLE}) + SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") + MESSAGE(STATUS "Looking for ${FUNCTION} - found") + ELSE(${VARIABLE}) + MESSAGE(STATUS "Looking for ${FUNCTION} - not found") + SET(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}") + WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log + "Determining if the function ${FUNCTION} exists failed with the following output:\n" + "${OUTPUT}\n" APPEND) + ENDIF(${VARIABLE}) + ENDIF(NOT ${VARIABLE}) ENDMACRO(CHECK_FUNCTION_EXISTS) diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index 16fdb86..b4e0929 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -7,23 +7,25 @@ # MACRO(CHECK_INCLUDE_FILE INCLUDE VARIABLE) - SET(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) - CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in - ${PROJECT_BINARY_DIR}/CMakeTmp/CheckIncludeFile.c IMMEDIATE) - MESSAGE(STATUS "Looking for ${INCLUDE}") - TRY_COMPILE(${VARIABLE} - ${PROJECT_BINARY_DIR} - ${PROJECT_BINARY_DIR}/CMakeTmp/CheckIncludeFile.c - OUTPUT_VARIABLE OUTPUT) - IF(${VARIABLE}) - MESSAGE(STATUS "Found ${INCLUDE}") - SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") - ELSE(${VARIABLE}) - MESSAGE(STATUS "${INCLUDE} not found.") - SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}") - WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log - "Determining if the include file ${INCLUDE} " - "exists failed with the following output:\n" - "${OUTPUT}\n" APPEND) - ENDIF(${VARIABLE}) + IF(NOT ${VARIABLE}) + SET(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) + CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in + ${PROJECT_BINARY_DIR}/CMakeTmp/CheckIncludeFile.c IMMEDIATE) + MESSAGE(STATUS "Looking for ${INCLUDE}") + TRY_COMPILE(${VARIABLE} + ${PROJECT_BINARY_DIR} + ${PROJECT_BINARY_DIR}/CMakeTmp/CheckIncludeFile.c + OUTPUT_VARIABLE OUTPUT) + IF(${VARIABLE}) + MESSAGE(STATUS "Looking for ${INCLUDE} - found") + SET(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") + ELSE(${VARIABLE}) + MESSAGE(STATUS "Looking for ${INCLUDE} - not found.") + SET(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}") + WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log + "Determining if the include file ${INCLUDE} " + "exists failed with the following output:\n" + "${OUTPUT}\n" APPEND) + ENDIF(${VARIABLE}) + ENDIF(NOT ${VARIABLE}) ENDMACRO(CHECK_INCLUDE_FILE) diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index af8a014..65a6ec8 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -7,26 +7,28 @@ # MACRO(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) - SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION -DCHECK_FUNCTION_EXISTS=${FUNCTION}) - MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") - TRY_COMPILE(${VARIABLE} - ${PROJECT_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} - OUTPUT_VARIABLE OUTPUT) + IF(NOT ${VARIABLE}) + SET(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION -DCHECK_FUNCTION_EXISTS=${FUNCTION}) + MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") + TRY_COMPILE(${VARIABLE} + ${PROJECT_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} + OUTPUT_VARIABLE OUTPUT) - IF(${VARIABLE}) - MESSAGE(STATUS "Found ${FUNCTION} in ${LIBRARY}") - SET(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}") - ELSE(${VARIABLE}) - MESSAGE(STATUS "${FUNCTION} in ${LIBRARY} not found") - SET(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}") - WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log - "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " - "failed with the following output:\n" - "${OUTPUT}\n" APPEND) - ENDIF(${VARIABLE}) + IF(${VARIABLE}) + MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found") + SET(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}") + ELSE(${VARIABLE}) + MESSAGE(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found") + SET(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}") + WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log + "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " + "failed with the following output:\n" + "${OUTPUT}\n" APPEND) + ENDIF(${VARIABLE}) + ENDIF(NOT ${VARIABLE}) ENDMACRO(CHECK_LIBRARY_EXISTS) diff --git a/Modules/CheckSizeOf.cmake b/Modules/CheckSizeOf.cmake index ddeb350..d375135 100644 --- a/Modules/CheckSizeOf.cmake +++ b/Modules/CheckSizeOf.cmake @@ -7,23 +7,28 @@ # MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) - SET(MACRO_CHECK_TYPE_SIZE_FLAGS -DCHECK_SIZE_OF="${TYPE}") - IF(HAVE_SYS_TYPES_H) - SET(MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -DHAVE_SYS_TYPES_H") - ENDIF(HAVE_SYS_TYPES_H) - IF(HAVE_STDINT_H) - SET(MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -DHAVE_STDINT_H") - ENDIF(HAVE_STDINT_H) - MESSAGE(STATUS "Check size of ${TYPE}") - TRY_RUN(${VARIABLE} HAVE_${VARIABLE} - ${PROJECT_BINARY_DIR} - ${CMAKE_ROOT}/Modules/CheckSizeOf.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS} - OUTPUT_VARIABLE OUTPUT) - IF(NOT HAVE_${VARIABLE}) - MESSAGE(STATUS "Error in Check size of ${TYPE}") - WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log - "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n" - APPEND) - ENDIF(NOT HAVE_${VARIABLE}) + IF(NOT ${VARIABLE}) + SET(MACRO_CHECK_TYPE_SIZE_FLAGS -DCHECK_SIZE_OF="${TYPE}") + IF(HAVE_SYS_TYPES_H) + SET(MACRO_CHECK_TYPE_SIZE_FLAGS + "${MACRO_CHECK_TYPE_SIZE_FLAGS} -DHAVE_SYS_TYPES_H") + ENDIF(HAVE_SYS_TYPES_H) + IF(HAVE_STDINT_H) + SET(MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -DHAVE_STDINT_H") + ENDIF(HAVE_STDINT_H) + MESSAGE(STATUS "Check size of ${TYPE}") + TRY_RUN(${VARIABLE} HAVE_${VARIABLE} + ${PROJECT_BINARY_DIR} + ${CMAKE_ROOT}/Modules/CheckSizeOf.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS} + OUTPUT_VARIABLE OUTPUT) + IF(HAVE_${VARIABLE}) + MESSAGE(STATUS "Check size of ${TYPE} - done") + ELSE(HAVE_${VARIABLE}) + MESSAGE(STATUS "Check size of ${TYPE} - failed") + WRITE_FILE(${PROJECT_BINARY_DIR}/CMakeError.log + "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\n" + APPEND) + ENDIF(HAVE_${VARIABLE}) + ENDIF(NOT ${VARIABLE}) ENDMACRO(CHECK_TYPE_SIZE) diff --git a/Modules/TestForANSIForScope.cmake b/Modules/TestForANSIForScope.cmake index c6434b4..3265f00 100644 --- a/Modules/TestForANSIForScope.cmake +++ b/Modules/TestForANSIForScope.cmake @@ -4,15 +4,20 @@ # CMAKE_NO_STD_NAMESPACE - defined accoreding to the results # -TRY_COMPILE(CMAKE_ANSI_FOR_SCOPE ${PROJECT_BINARY_DIR} - ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx) -IF (CMAKE_ANSI_FOR_SCOPE) - SET (CMAKE_NO_ANSI_FOR_SCOPE 0 CACHE INTERNAL +IF(NOT CMAKE_ANSI_FOR_SCOPE) + MESSAGE(STATUS "Check for ANSI scope") + TRY_COMPILE(CMAKE_ANSI_FOR_SCOPE ${PROJECT_BINARY_DIR} + ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx) + IF (CMAKE_ANSI_FOR_SCOPE) + MESSAGE(STATUS "Check for ANSI scope - found") + SET (CMAKE_NO_ANSI_FOR_SCOPE 0 CACHE INTERNAL + "Does the compiler support ansi for scope.") + ELSE (CMAKE_ANSI_FOR_SCOPE) + MESSAGE(STATUS "Check for ANSI scope - not found") + SET (CMAKE_NO_ANSI_FOR_SCOPE 1 CACHE INTERNAL "Does the compiler support ansi for scope.") -ELSE (CMAKE_ANSI_FOR_SCOPE) - SET (CMAKE_NO_ANSI_FOR_SCOPE 1 CACHE INTERNAL - "Does the compiler support ansi for scope.") -ENDIF (CMAKE_ANSI_FOR_SCOPE) + ENDIF (CMAKE_ANSI_FOR_SCOPE) +ENDIF(NOT CMAKE_ANSI_FOR_SCOPE) diff --git a/Modules/TestForANSIStreamHeaders.cmake b/Modules/TestForANSIStreamHeaders.cmake index 10ecb01..7ea1071 100644 --- a/Modules/TestForANSIStreamHeaders.cmake +++ b/Modules/TestForANSIStreamHeaders.cmake @@ -4,16 +4,21 @@ # CMAKE_NO_ANSI_STREAM_HEADERS - defined accoreding to the results # -TRY_COMPILE(CMAKE_ANSI_STREAM_HEADERS ${PROJECT_BINARY_DIR} - ${CMAKE_ROOT}/Modules/TestForANSIStreamHeaders.cxx) -IF (CMAKE_ANSI_STREAM_HEADERS) - SET (CMAKE_NO_ANSI_STREAM_HEADERS 0 CACHE INTERNAL +IF(NOT CMAKE_NO_ANSI_STREAM_HEADERS) + MESSAGE(STATUS "Check for ANSI stream headers") + TRY_COMPILE(CMAKE_ANSI_STREAM_HEADERS ${PROJECT_BINARY_DIR} + ${CMAKE_ROOT}/Modules/TestForANSIStreamHeaders.cxx) + IF (CMAKE_ANSI_STREAM_HEADERS) + MESSAGE(STATUS "Check for ANSI stream headers - found") + SET (CMAKE_NO_ANSI_STREAM_HEADERS 0 CACHE INTERNAL + "Does the compiler support headers like iostream.") + ELSE (CMAKE_ANSI_STREAM_HEADERS) + MESSAGE(STATUS "Check for ANSI stream headers - not found") + SET (CMAKE_NO_ANSI_STREAM_HEADERS 1 CACHE INTERNAL "Does the compiler support headers like iostream.") -ELSE (CMAKE_ANSI_STREAM_HEADERS) - SET (CMAKE_NO_ANSI_STREAM_HEADERS 1 CACHE INTERNAL - "Does the compiler support headers like iostream.") -ENDIF (CMAKE_ANSI_STREAM_HEADERS) + ENDIF (CMAKE_ANSI_STREAM_HEADERS) -MARK_AS_ADVANCED(CMAKE_NO_ANSI_STREAM_HEADERS) + MARK_AS_ADVANCED(CMAKE_NO_ANSI_STREAM_HEADERS) +ENDIF(NOT CMAKE_NO_ANSI_STREAM_HEADERS) diff --git a/Modules/TestForSTDNamespace.cmake b/Modules/TestForSTDNamespace.cmake index 304d1c3..9f14558 100644 --- a/Modules/TestForSTDNamespace.cmake +++ b/Modules/TestForSTDNamespace.cmake @@ -4,15 +4,20 @@ # CMAKE_NO_STD_NAMESPACE - defined accoreding to the results # -TRY_COMPILE(CMAKE_STD_NAMESPACE ${PROJECT_BINARY_DIR} - ${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx) -IF (CMAKE_STD_NAMESPACE) - SET (CMAKE_NO_STD_NAMESPACE 0 CACHE INTERNAL +IF(NOT CMAKE_STD_NAMESPACE) + MESSAGE(STATUS "Check for STD namespace") + TRY_COMPILE(CMAKE_STD_NAMESPACE ${PROJECT_BINARY_DIR} + ${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx) + IF (CMAKE_STD_NAMESPACE) + MESSAGE(STATUS "Check for STD namespace - found") + SET (CMAKE_NO_STD_NAMESPACE 0 CACHE INTERNAL + "Does the compiler support std::.") + ELSE (CMAKE_STD_NAMESPACE) + MESSAGE(STATUS "Check for STD namespace - not found") + SET (CMAKE_NO_STD_NAMESPACE 1 CACHE INTERNAL "Does the compiler support std::.") -ELSE (CMAKE_STD_NAMESPACE) - SET (CMAKE_NO_STD_NAMESPACE 1 CACHE INTERNAL - "Does the compiler support std::.") -ENDIF (CMAKE_STD_NAMESPACE) + ENDIF (CMAKE_STD_NAMESPACE) +ENDIF(NOT CMAKE_STD_NAMESPACE) |