Check*.cmake : Add CMAKE_REQUIRED_QUIET flag.

Setting this flag can silence messages from the Check*.cmake modules.
This can be used by Find*.cmake modules when they are in silent mode.
This commit is contained in:
Clinton Stimpson 2014-03-29 20:12:27 -06:00
parent ede0419a37
commit 4c0cc9ab91
16 changed files with 132 additions and 38 deletions

View File

@ -53,6 +53,7 @@ macro(CMAKE_RESET_CHECK_STATE)
set(CMAKE_REQUIRED_DEFINITIONS) set(CMAKE_REQUIRED_DEFINITIONS)
set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_REQUIRED_FLAGS) set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_QUIET)
endmacro() endmacro()
@ -68,6 +69,7 @@ macro(CMAKE_PUSH_CHECK_STATE)
set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS}) set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES}) set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS}) set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS})
set(_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_QUIET})
if (ARGC GREATER 0 AND ARGV0 STREQUAL "RESET") if (ARGC GREATER 0 AND ARGV0 STREQUAL "RESET")
cmake_reset_check_state() cmake_reset_check_state()
@ -84,6 +86,7 @@ macro(CMAKE_POP_CHECK_STATE)
set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) set(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
set(CMAKE_REQUIRED_QUIET ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1") math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1")
endif() endif()

View File

@ -21,6 +21,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2005-2009 Kitware, Inc. # Copyright 2005-2009 Kitware, Inc.
@ -67,7 +68,9 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
"${SOURCE}\n") "${SOURCE}\n")
message(STATUS "Performing Test ${VAR}") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VAR}")
endif()
try_compile(${VAR} try_compile(${VAR}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
@ -85,13 +88,17 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
if(${VAR}) if(${VAR})
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
message(STATUS "Performing Test ${VAR} - Success") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VAR} - Success")
endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n" "${OUTPUT}\n"
"Source file was:\n${SOURCE}\n") "Source file was:\n${SOURCE}\n")
else() else()
message(STATUS "Performing Test ${VAR} - Failed") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VAR} - Failed")
endif()
set(${VAR} "" CACHE INTERNAL "Test ${VAR}") set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"

View File

@ -21,6 +21,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2006-2009 Kitware, Inc. # Copyright 2006-2009 Kitware, Inc.
@ -56,7 +57,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
"${SOURCE}\n") "${SOURCE}\n")
message(STATUS "Performing Test ${VAR}") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VAR}")
endif()
try_run(${VAR}_EXITCODE ${VAR}_COMPILED try_run(${VAR}_EXITCODE ${VAR}_COMPILED
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
@ -73,7 +76,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
# if the return value was 0 then it worked # if the return value was 0 then it worked
if("${${VAR}_EXITCODE}" EQUAL 0) if("${${VAR}_EXITCODE}" EQUAL 0)
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
message(STATUS "Performing Test ${VAR} - Success") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VAR} - Success")
endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n" "${OUTPUT}\n"
@ -86,7 +91,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
set(${VAR} "" CACHE INTERNAL "Test ${VAR}") set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
endif() endif()
message(STATUS "Performing Test ${VAR} - Failed") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VAR} - Failed")
endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n" "${OUTPUT}\n"

View File

@ -21,6 +21,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2005-2009 Kitware, Inc. # Copyright 2005-2009 Kitware, Inc.
@ -68,7 +69,9 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
"${SOURCE}\n") "${SOURCE}\n")
message(STATUS "Performing Test ${VAR}") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VAR}")
endif()
try_compile(${VAR} try_compile(${VAR}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
@ -86,13 +89,17 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
if(${VAR}) if(${VAR})
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
message(STATUS "Performing Test ${VAR} - Success") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VAR} - Success")
endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n" "${OUTPUT}\n"
"Source file was:\n${SOURCE}\n") "Source file was:\n${SOURCE}\n")
else() else()
message(STATUS "Performing Test ${VAR} - Failed") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VAR} - Failed")
endif()
set(${VAR} "" CACHE INTERNAL "Test ${VAR}") set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"

View File

@ -21,6 +21,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2006-2009 Kitware, Inc. # Copyright 2006-2009 Kitware, Inc.
@ -56,7 +57,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
"${SOURCE}\n") "${SOURCE}\n")
message(STATUS "Performing Test ${VAR}") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VAR}")
endif()
try_run(${VAR}_EXITCODE ${VAR}_COMPILED try_run(${VAR}_EXITCODE ${VAR}_COMPILED
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
@ -74,7 +77,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
# if the return value was 0 then it worked # if the return value was 0 then it worked
if("${${VAR}_EXITCODE}" EQUAL 0) if("${${VAR}_EXITCODE}" EQUAL 0)
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
message(STATUS "Performing Test ${VAR} - Success") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VAR} - Success")
endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
"${OUTPUT}\n" "${OUTPUT}\n"
@ -87,7 +92,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
set(${VAR} "" CACHE INTERNAL "Test ${VAR}") set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
endif() endif()
message(STATUS "Performing Test ${VAR} - Failed") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Performing Test ${VAR} - Failed")
endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
"${OUTPUT}\n" "${OUTPUT}\n"

View File

@ -27,6 +27,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2003-2011 Kitware, Inc. # Copyright 2003-2011 Kitware, Inc.

View File

@ -20,6 +20,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2002-2011 Kitware, Inc. # Copyright 2002-2011 Kitware, Inc.
@ -40,7 +41,9 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
if("${VARIABLE}" MATCHES "^${VARIABLE}$") if("${VARIABLE}" MATCHES "^${VARIABLE}$")
set(MACRO_CHECK_FUNCTION_DEFINITIONS set(MACRO_CHECK_FUNCTION_DEFINITIONS
"-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Looking for ${FUNCTION}") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${FUNCTION}")
endif()
if(CMAKE_REQUIRED_LIBRARIES) if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@ -63,12 +66,16 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE}) if(${VARIABLE})
set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}")
message(STATUS "Looking for ${FUNCTION} - found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${FUNCTION} - found")
endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the function ${FUNCTION} exists passed with the following output:\n" "Determining if the function ${FUNCTION} exists passed with the following output:\n"
"${OUTPUT}\n\n") "${OUTPUT}\n\n")
else() else()
message(STATUS "Looking for ${FUNCTION} - not found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${FUNCTION} - not found")
endif()
set(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}") set(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the function ${FUNCTION} exists failed with the following output:\n" "Determining if the function ${FUNCTION} exists failed with the following output:\n"

View File

@ -24,6 +24,7 @@
# CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2002-2009 Kitware, Inc. # Copyright 2002-2009 Kitware, Inc.
@ -49,7 +50,9 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
set(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) set(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c) ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c)
message(STATUS "Looking for ${INCLUDE}") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${INCLUDE}")
endif()
if(${ARGC} EQUAL 3) if(${ARGC} EQUAL 3)
set(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS}) set(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}")
@ -69,14 +72,18 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
endif() endif()
if(${VARIABLE}) if(${VARIABLE})
message(STATUS "Looking for ${INCLUDE} - found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${INCLUDE} - found")
endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the include file ${INCLUDE} " "Determining if the include file ${INCLUDE} "
"exists passed with the following output:\n" "exists passed with the following output:\n"
"${OUTPUT}\n\n") "${OUTPUT}\n\n")
else() else()
message(STATUS "Looking for ${INCLUDE} - not found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${INCLUDE} - not found")
endif()
set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}") set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the include file ${INCLUDE} " "Determining if the include file ${INCLUDE} "

View File

@ -28,6 +28,7 @@
# CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2002-2009 Kitware, Inc. # Copyright 2002-2009 Kitware, Inc.
@ -53,7 +54,9 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
set(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) set(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx) ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx)
message(STATUS "Looking for C++ include ${INCLUDE}") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for C++ include ${INCLUDE}")
endif()
if(${ARGC} EQUAL 3) if(${ARGC} EQUAL 3)
set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS}) set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}")
@ -73,14 +76,18 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
endif() endif()
if(${VARIABLE}) if(${VARIABLE})
message(STATUS "Looking for C++ include ${INCLUDE} - found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for C++ include ${INCLUDE} - found")
endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the include file ${INCLUDE} " "Determining if the include file ${INCLUDE} "
"exists passed with the following output:\n" "exists passed with the following output:\n"
"${OUTPUT}\n\n") "${OUTPUT}\n\n")
else() else()
message(STATUS "Looking for C++ include ${INCLUDE} - not found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for C++ include ${INCLUDE} - not found")
endif()
set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}") set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the include file ${INCLUDE} " "Determining if the include file ${INCLUDE} "

View File

@ -23,6 +23,7 @@
# CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2003-2012 Kitware, Inc. # Copyright 2003-2012 Kitware, Inc.
@ -66,7 +67,9 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
set(_description "include file ${_INCLUDE}") set(_description "include file ${_INCLUDE}")
endif() endif()
message(STATUS "Looking for ${_description}") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${_description}")
endif()
try_compile(${VARIABLE} try_compile(${VARIABLE}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c
@ -76,14 +79,18 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
"${CHECK_INCLUDE_FILES_INCLUDE_DIRS}" "${CHECK_INCLUDE_FILES_INCLUDE_DIRS}"
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE}) if(${VARIABLE})
message(STATUS "Looking for ${_description} - found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${_description} - found")
endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}") set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if files ${INCLUDE} " "Determining if files ${INCLUDE} "
"exist passed with the following output:\n" "exist passed with the following output:\n"
"${OUTPUT}\n\n") "${OUTPUT}\n\n")
else() else()
message(STATUS "Looking for ${_description} - not found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${_description} - not found")
endif()
set(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}") set(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if files ${INCLUDE} " "Determining if files ${INCLUDE} "

View File

@ -23,6 +23,7 @@
# CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2002-2009 Kitware, Inc. # Copyright 2002-2009 Kitware, Inc.
@ -43,7 +44,9 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
if("${VARIABLE}" MATCHES "^${VARIABLE}$") if("${VARIABLE}" MATCHES "^${VARIABLE}$")
set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION
"-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}") "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
endif()
set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY}) set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY})
if(CMAKE_REQUIRED_LIBRARIES) if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_LIBRARY_EXISTS_LIBRARIES set(CHECK_LIBRARY_EXISTS_LIBRARIES
@ -60,14 +63,18 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE}) if(${VARIABLE})
message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found")
endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}") set(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "Determining if the function ${FUNCTION} exists in the ${LIBRARY} "
"passed with the following output:\n" "passed with the following output:\n"
"${OUTPUT}\n\n") "${OUTPUT}\n\n")
else() else()
message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found")
endif()
set(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}") set(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "Determining if the function ${FUNCTION} exists in the ${LIBRARY} "

View File

@ -33,6 +33,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2005-2009 Kitware, Inc. # Copyright 2005-2009 Kitware, Inc.
@ -97,12 +98,16 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB
if (${_VARIABLE}) if (${_VARIABLE})
set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}") set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True")
endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n" "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n"
"${OUTPUT}\n\n") "${OUTPUT}\n\n")
else () else ()
message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False")
endif()
set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}") set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n" "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n"

View File

@ -28,6 +28,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
# #
# #
# #

View File

@ -28,6 +28,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2003-2011 Kitware, Inc. # Copyright 2003-2011 Kitware, Inc.
@ -74,7 +75,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
"${SOURCEFILE}" @ONLY) "${SOURCEFILE}" @ONLY)
message(STATUS "Looking for ${SYMBOL}") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${SYMBOL}")
endif()
try_compile(${VARIABLE} try_compile(${VARIABLE}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
"${SOURCEFILE}" "${SOURCEFILE}"
@ -85,7 +88,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
"${CMAKE_SYMBOL_EXISTS_INCLUDES}" "${CMAKE_SYMBOL_EXISTS_INCLUDES}"
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE}) if(${VARIABLE})
message(STATUS "Looking for ${SYMBOL} - found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${SYMBOL} - found")
endif()
set(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") set(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the ${SYMBOL} " "Determining if the ${SYMBOL} "
@ -93,7 +98,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
"${OUTPUT}\nFile ${SOURCEFILE}:\n" "${OUTPUT}\nFile ${SOURCEFILE}:\n"
"${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
else() else()
message(STATUS "Looking for ${SYMBOL} - not found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${SYMBOL} - not found")
endif()
set(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}") set(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}")
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the ${SYMBOL} " "Determining if the ${SYMBOL} "

View File

@ -59,6 +59,7 @@
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_INCLUDES = list of include directories
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
# CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include # CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include
#============================================================================= #=============================================================================
@ -85,7 +86,9 @@ get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Helper function. DO NOT CALL DIRECTLY. # Helper function. DO NOT CALL DIRECTLY.
function(__check_type_size_impl type var map builtin language) function(__check_type_size_impl type var map builtin language)
message(STATUS "Check size of ${type}") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Check size of ${type}")
endif()
# Include header files. # Include header files.
set(headers) set(headers)
@ -169,13 +172,17 @@ function(__check_type_size_impl type var map builtin language)
message(SEND_ERROR "CHECK_TYPE_SIZE found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !") message(SEND_ERROR "CHECK_TYPE_SIZE found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !")
endif() endif()
message(STATUS "Check size of ${type} - done") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Check size of ${type} - done")
endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining size of ${type} passed with the following output:\n${output}\n\n") "Determining size of ${type} passed with the following output:\n${output}\n\n")
set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})") set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})")
else() else()
# The check failed to compile. # The check failed to compile.
message(STATUS "Check size of ${type} - failed") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Check size of ${type} - failed")
endif()
file(READ ${src} content) file(READ ${src} content)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining size of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n") "Determining size of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n")

View File

@ -27,6 +27,7 @@
# CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_FLAGS = string of compile command line flags
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
# CMAKE_REQUIRED_QUIET = execute quietly without messages
#============================================================================= #=============================================================================
# Copyright 2002-2009 Kitware, Inc. # Copyright 2002-2009 Kitware, Inc.
@ -47,7 +48,9 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
if("${VARIABLE}" MATCHES "^${VARIABLE}$") if("${VARIABLE}" MATCHES "^${VARIABLE}$")
set(MACRO_CHECK_VARIABLE_DEFINITIONS set(MACRO_CHECK_VARIABLE_DEFINITIONS
"-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}") "-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Looking for ${VAR}") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${VAR}")
endif()
if(CMAKE_REQUIRED_LIBRARIES) if(CMAKE_REQUIRED_LIBRARIES)
set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@ -63,13 +66,17 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
if(${VARIABLE}) if(${VARIABLE})
set(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}") set(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}")
message(STATUS "Looking for ${VAR} - found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${VAR} - found")
endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the variable ${VAR} exists passed with the following output:\n" "Determining if the variable ${VAR} exists passed with the following output:\n"
"${OUTPUT}\n\n") "${OUTPUT}\n\n")
else() else()
set(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}") set(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}")
message(STATUS "Looking for ${VAR} - not found") if(NOT CMAKE_REQUIRED_QUIET)
message(STATUS "Looking for ${VAR} - not found")
endif()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the variable ${VAR} exists failed with the following output:\n" "Determining if the variable ${VAR} exists failed with the following output:\n"
"${OUTPUT}\n\n") "${OUTPUT}\n\n")