Add more messages, make messages look the same, add checks if test was already successfull

This commit is contained in:
Andy Cedilnik 2002-11-18 10:52:09 -05:00
parent ebb6477dbb
commit 5b17658c91
7 changed files with 127 additions and 101 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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