From 4c0cc9ab9195d348ea5f1b004789ec334531bbb1 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Sat, 29 Mar 2014 20:12:27 -0600 Subject: [PATCH 1/2] 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. --- Modules/CMakePushCheckState.cmake | 3 +++ Modules/CheckCSourceCompiles.cmake | 13 ++++++++++--- Modules/CheckCSourceRuns.cmake | 13 ++++++++++--- Modules/CheckCXXSourceCompiles.cmake | 13 ++++++++++--- Modules/CheckCXXSourceRuns.cmake | 13 ++++++++++--- Modules/CheckCXXSymbolExists.cmake | 1 + Modules/CheckFunctionExists.cmake | 13 ++++++++++--- Modules/CheckIncludeFile.cmake | 13 ++++++++++--- Modules/CheckIncludeFileCXX.cmake | 13 ++++++++++--- Modules/CheckIncludeFiles.cmake | 13 ++++++++++--- Modules/CheckLibraryExists.cmake | 13 ++++++++++--- Modules/CheckPrototypeDefinition.cmake | 9 +++++++-- Modules/CheckStructHasMember.cmake | 1 + Modules/CheckSymbolExists.cmake | 13 ++++++++++--- Modules/CheckTypeSize.cmake | 13 ++++++++++--- Modules/CheckVariableExists.cmake | 13 ++++++++++--- 16 files changed, 132 insertions(+), 38 deletions(-) diff --git a/Modules/CMakePushCheckState.cmake b/Modules/CMakePushCheckState.cmake index 39f002379..bf4ec0e9c 100644 --- a/Modules/CMakePushCheckState.cmake +++ b/Modules/CMakePushCheckState.cmake @@ -53,6 +53,7 @@ macro(CMAKE_RESET_CHECK_STATE) set(CMAKE_REQUIRED_DEFINITIONS) set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_QUIET) 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_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_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_QUIET}) if (ARGC GREATER 0 AND ARGV0 STREQUAL "RESET") 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_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_QUIET ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}}) math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1") endif() diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index c2f6915e3..8721d5590 100644 --- a/Modules/CheckCSourceCompiles.cmake +++ b/Modules/CheckCSourceCompiles.cmake @@ -21,6 +21,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # 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" "${SOURCE}\n") - message(STATUS "Performing Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() try_compile(${VAR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c @@ -85,13 +88,17 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR) if(${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 "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake index 2e68454c4..a4fa57efb 100644 --- a/Modules/CheckCSourceRuns.cmake +++ b/Modules/CheckCSourceRuns.cmake @@ -21,6 +21,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # 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" "${SOURCE}\n") - message(STATUS "Performing Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() try_run(${VAR}_EXITCODE ${VAR}_COMPILED ${CMAKE_BINARY_DIR} ${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("${${VAR}_EXITCODE}" EQUAL 0) 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 "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" @@ -86,7 +91,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR) set(${VAR} "" CACHE INTERNAL "Test ${VAR}") 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 "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake index c7ef5ecac..6ce64a1b0 100644 --- a/Modules/CheckCXXSourceCompiles.cmake +++ b/Modules/CheckCXXSourceCompiles.cmake @@ -21,6 +21,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # 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" "${SOURCE}\n") - message(STATUS "Performing Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() try_compile(${VAR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx @@ -86,13 +89,17 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR) if(${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 "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index 4e3ff6c2c..c65586385 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -21,6 +21,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # 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" "${SOURCE}\n") - message(STATUS "Performing Test ${VAR}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Performing Test ${VAR}") + endif() try_run(${VAR}_EXITCODE ${VAR}_COMPILED ${CMAKE_BINARY_DIR} ${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("${${VAR}_EXITCODE}" EQUAL 0) 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 "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n" "${OUTPUT}\n" @@ -87,7 +92,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) set(${VAR} "" CACHE INTERNAL "Test ${VAR}") 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 "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" diff --git a/Modules/CheckCXXSymbolExists.cmake b/Modules/CheckCXXSymbolExists.cmake index aa62fbf5a..084fbb422 100644 --- a/Modules/CheckCXXSymbolExists.cmake +++ b/Modules/CheckCXXSymbolExists.cmake @@ -27,6 +27,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2003-2011 Kitware, Inc. diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index e232bd7b6..bfd183691 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -20,6 +20,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2011 Kitware, Inc. @@ -40,7 +41,9 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) if("${VARIABLE}" MATCHES "^${VARIABLE}$") set(MACRO_CHECK_FUNCTION_DEFINITIONS "-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) set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) @@ -63,12 +66,16 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) 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 "Determining if the function ${FUNCTION} exists passed with the following output:\n" "${OUTPUT}\n\n") 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists failed with the following output:\n" diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index 9dc1648dd..ea7326763 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -24,6 +24,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -49,7 +50,9 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE) set(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in ${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) set(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}") @@ -69,14 +72,18 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE) endif() 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the include file ${INCLUDE} " "exists passed with the following output:\n" "${OUTPUT}\n\n") 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the include file ${INCLUDE} " diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index fa36a3fd4..39abeff5b 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -28,6 +28,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -53,7 +54,9 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) set(CHECK_INCLUDE_FILE_VAR ${INCLUDE}) configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in ${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) set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}") @@ -73,14 +76,18 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) endif() 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the include file ${INCLUDE} " "exists passed with the following output:\n" "${OUTPUT}\n\n") 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the include file ${INCLUDE} " diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index 182067f57..6aa0f2b68 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -23,6 +23,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2003-2012 Kitware, Inc. @@ -66,7 +67,9 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) set(_description "include file ${_INCLUDE}") endif() - message(STATUS "Looking for ${_description}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${_description}") + endif() try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c @@ -76,14 +79,18 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) "${CHECK_INCLUDE_FILES_INCLUDE_DIRS}" OUTPUT_VARIABLE OUTPUT) 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if files ${INCLUDE} " "exist passed with the following output:\n" "${OUTPUT}\n\n") 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if files ${INCLUDE} " diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake index f5c563c20..2b4137956 100644 --- a/Modules/CheckLibraryExists.cmake +++ b/Modules/CheckLibraryExists.cmake @@ -23,6 +23,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -43,7 +44,9 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) if("${VARIABLE}" MATCHES "^${VARIABLE}$") set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION "-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}) if(CMAKE_REQUIRED_LIBRARIES) set(CHECK_LIBRARY_EXISTS_LIBRARIES @@ -60,14 +63,18 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE) OUTPUT_VARIABLE OUTPUT) 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " "passed with the following output:\n" "${OUTPUT}\n\n") 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the function ${FUNCTION} exists in the ${LIBRARY} " diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index 25ea7f499..fe000744c 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -33,6 +33,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2005-2009 Kitware, Inc. @@ -97,12 +98,16 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB if (${_VARIABLE}) 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 "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n" "${OUTPUT}\n\n") 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n" diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index a864e824c..880a688e2 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -28,6 +28,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages # # # diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index e1ca41255..bf2e7973e 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -28,6 +28,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2003-2011 Kitware, Inc. @@ -74,7 +75,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" "${SOURCEFILE}" @ONLY) - message(STATUS "Looking for ${SYMBOL}") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${SYMBOL}") + endif() try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} "${SOURCEFILE}" @@ -85,7 +88,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) "${CMAKE_SYMBOL_EXISTS_INCLUDES}" OUTPUT_VARIABLE OUTPUT) 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the ${SYMBOL} " @@ -93,7 +98,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) "${OUTPUT}\nFile ${SOURCEFILE}:\n" "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") 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}") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the ${SYMBOL} " diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 333b325f8..d4651b94c 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -59,6 +59,7 @@ # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_INCLUDES = list of include directories # 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 #============================================================================= @@ -85,7 +86,9 @@ get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) #----------------------------------------------------------------------------- # Helper function. DO NOT CALL DIRECTLY. 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. 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 !") 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 "Determining size of ${type} passed with the following output:\n${output}\n\n") set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})") else() # 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(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") diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake index 4861ff07a..3a7ef13bd 100644 --- a/Modules/CheckVariableExists.cmake +++ b/Modules/CheckVariableExists.cmake @@ -27,6 +27,7 @@ # CMAKE_REQUIRED_FLAGS = string of compile command line flags # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) # CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2002-2009 Kitware, Inc. @@ -47,7 +48,9 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE) if("${VARIABLE}" MATCHES "^${VARIABLE}$") set(MACRO_CHECK_VARIABLE_DEFINITIONS "-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) set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) @@ -63,13 +66,17 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE) OUTPUT_VARIABLE OUTPUT) if(${VARIABLE}) 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 "Determining if the variable ${VAR} exists passed with the following output:\n" "${OUTPUT}\n\n") else() 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 "Determining if the variable ${VAR} exists failed with the following output:\n" "${OUTPUT}\n\n") From 83934757c942672d8bea79f11e51a184b168a212 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Sat, 29 Mar 2014 20:22:54 -0600 Subject: [PATCH 2/2] Find*: Make find_package(.. QUIET) affect Check* modules. Fixes issues #14812 and #14813 where find_package(OpenMP QUIET) and find_package(Qt4 QUIET) would still print out messages when calling check*() functions. Also a partial fix for #14445 where building CMake (without cmake-gui) when Qt5 is installed and Qt4 is not installed and warnings come out of FindQt4.cmake. --- Modules/FindBLAS.cmake | 4 ++++ Modules/FindBZip2.cmake | 4 ++++ Modules/FindBacktrace.cmake | 1 + Modules/FindCups.cmake | 4 ++++ Modules/FindCurses.cmake | 4 ++++ Modules/FindGIF.cmake | 1 + Modules/FindLAPACK.cmake | 5 +++++ Modules/FindLibLZMA.cmake | 3 +++ Modules/FindOpenCL.cmake | 1 + Modules/FindOpenMP.cmake | 12 ++++++++++-- Modules/FindQt4.cmake | 20 +++++++++++--------- Modules/FindThreads.cmake | 3 +++ Modules/FindX11.cmake | 3 +++ 13 files changed, 54 insertions(+), 11 deletions(-) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 3b658ef38..1cf91248b 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -52,6 +52,9 @@ include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) +cmake_push_check_state() +set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY}) set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) @@ -687,4 +690,5 @@ else() endif() endif() +cmake_pop_check_state() set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index 388387735..b4793327d 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -57,7 +57,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 if (BZIP2_FOUND) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + cmake_push_check_state() + set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY}) CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX) + cmake_pop_check_state() endif () mark_as_advanced(BZIP2_INCLUDE_DIR) diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake index 83789cc7d..5620661fe 100644 --- a/Modules/FindBacktrace.cmake +++ b/Modules/FindBacktrace.cmake @@ -62,6 +62,7 @@ if (NOT DEFINED Backtrace_LIBRARY) # First, check if we already have backtrace(), e.g., in libc cmake_push_check_state(RESET) set(CMAKE_REQUIRED_INCLUDES ${Backtrace_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_QUIET ${Backtrace_FIND_QUIETLY}) check_symbol_exists("backtrace" "${_Backtrace_HEADER_TRY}" _Backtrace_SYM_FOUND) cmake_pop_check_state() endif() diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake index 4b55d6a58..61353caf9 100644 --- a/Modules/FindCups.cmake +++ b/Modules/FindCups.cmake @@ -36,9 +36,13 @@ find_library(CUPS_LIBRARIES NAMES cups ) if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + cmake_push_check_state() + set(CMAKE_REQUIRED_QUIET ${Cups_FIND_QUIETLY}) # ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint) CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE) + cmake_pop_check_state() endif () if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h") diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index 971edb75f..fa420c1fd 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -67,6 +67,9 @@ endif() # default search paths. if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + cmake_push_check_state() + set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY}) CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}" wsyncup "" CURSES_CURSES_HAS_WSYNCUP) @@ -77,6 +80,7 @@ if(CURSES_CURSES_LIBRARY AND CURSES_NEED_NCURSES) set(CURSES_USE_NCURSES TRUE) endif() endif() + cmake_pop_check_state() endif() diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index 117ded76d..7bbb8cfcd 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -66,6 +66,7 @@ if(GIF_INCLUDE_DIR) include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CheckStructHasMember.cmake) CMAKE_PUSH_CHECK_STATE() + set(CMAKE_REQUIRED_QUIET ${GIF_FIND_QUIETLY}) set(GIF_VERSION 3) set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}") CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData ) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 69da4cd9c..33f4f0c73 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -54,6 +54,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) else () include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) endif () +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) + +cmake_push_check_state() +set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY}) set(LAPACK_FOUND FALSE) set(LAPACK95_FOUND FALSE) @@ -347,4 +351,5 @@ else() endif() endif() +cmake_pop_check_state() set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake index be01594b4..742b851cd 100644 --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake @@ -55,9 +55,12 @@ endif() # Avoid using old codebase if (LIBLZMA_LIBRARY) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) + set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) + set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY}) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) + set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) endif () include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake index eee06bf44..b5eed9a04 100644 --- a/Modules/FindOpenCL.cmake +++ b/Modules/FindOpenCL.cmake @@ -35,6 +35,7 @@ function(_FIND_OPENCL_VERSION) include(CheckSymbolExists) include(CMakePushCheckState) + set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY}) CMAKE_PUSH_CHECK_STATE() foreach(VERSION "2_0" "1_2" "1_1" "1_0") diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index fead4a6da..30972ae0c 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -39,6 +39,8 @@ # License text for the above reference.) set(_OPENMP_REQUIRED_VARS) +set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) +set(CMAKE_REQUIRED_QUIET ${OpenMP_FIND_QUIETLY}) function(_OPENMP_FLAG_CANDIDATES LANG) set(OpenMP_FLAG_CANDIDATES @@ -116,7 +118,9 @@ if(CMAKE_C_COMPILER_LOADED) set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${FLAG}") unset(OpenMP_FLAG_DETECTED CACHE) - message(STATUS "Try OpenMP C flag = [${FLAG}]") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Try OpenMP C flag = [${FLAG}]") + endif() check_c_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED) set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") if(OpenMP_FLAG_DETECTED) @@ -150,7 +154,9 @@ if(CMAKE_CXX_COMPILER_LOADED) set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${FLAG}") unset(OpenMP_FLAG_DETECTED CACHE) - message(STATUS "Try OpenMP CXX flag = [${FLAG}]") + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Try OpenMP CXX flag = [${FLAG}]") + endif() check_cxx_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED) set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") if(OpenMP_FLAG_DETECTED) @@ -167,6 +173,8 @@ if(CMAKE_CXX_COMPILER_LOADED) unset(OpenMP_CXX_TEST_SOURCE) endif() +set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) + if(_OPENMP_REQUIRED_VARS) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index d0515c682..e44d1d9d8 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -335,6 +335,7 @@ endif() include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSymbolExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/MacroAddFileDependencies.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) set(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake) @@ -613,9 +614,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) set(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE) set(QT_QTCORE_FOUND 1) else() - message(WARNING "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as \"${QT_LIBRARY_DIR_TMP}\" " - "but QtCore could not be found there. " - "Qt is NOT installed correctly for the target build environment.") + if(NOT Qt4_FIND_QUIETLY) + message(WARNING + "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as " + "\"${QT_LIBRARY_DIR_TMP}\" " + "but QtCore could not be found there. " + "Qt is NOT installed correctly for the target build environment.") + endif() set(Qt4_FOUND FALSE) if(Qt4_FIND_REQUIRED) message( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.") @@ -747,11 +752,10 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) # Find out what window system we're using # ############################################# - # Save required variable - set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) - set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS}) + cmake_push_check_state() # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}") + set(CMAKE_REQUIRED_QUIET ${Qt4_FIND_QUIETLY}) # Check for Window system symbols (note: only one should end up being set) CHECK_CXX_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11) CHECK_CXX_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN) @@ -771,9 +775,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) endif () endif () - # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables - set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) - set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE}) + cmake_pop_check_state() # ############################################# diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 7f8452228..6d1c65d02 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -37,6 +37,8 @@ include (CheckIncludeFiles) include (CheckLibraryExists) include (CheckSymbolExists) set(Threads_FOUND FALSE) +set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) +set(CMAKE_REQUIRED_QUIET ${Threads_FIND_QUIETLY}) # Do we have sproc? if(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD) @@ -173,5 +175,6 @@ if(CMAKE_USE_PTHREADS_INIT) endif() endif() +set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND) diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 67cecc212..3a31cf05d 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -73,6 +73,8 @@ if (UNIX) # found in tcl on the mac set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK}) set(CMAKE_FIND_FRAMEWORK NEVER) + set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) + set(CMAKE_REQUIRED_QUIET ${X11_FIND_QUIETLY}) set(X11_INC_SEARCH_PATH /usr/pkg/xorg/include /usr/X11R6/include @@ -507,6 +509,7 @@ if (UNIX) X11_XSync_INCLUDE_PATH ) set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE}) + set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) endif () # X11_FIND_REQUIRED_ could be checked too