From: maier Date: Fri, 5 Apr 2013 09:19:20 +0000 (+0000) Subject: CMake: Introduce the same caching method for the sanity checks X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=180b26e4b7f98a5087b8128f8488702aa5d07298;p=dealii-svn.git CMake: Introduce the same caching method for the sanity checks git-svn-id: https://svn.dealii.org/trunk@29200 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/setup_compiler_flags.cmake b/deal.II/cmake/setup_compiler_flags.cmake index b8bbda6984..db784362b4 100644 --- a/deal.II/cmake/setup_compiler_flags.cmake +++ b/deal.II/cmake/setup_compiler_flags.cmake @@ -62,13 +62,18 @@ # # Check the user provided C and CXX flags: -# Only do this for CMAKE_C_FLAGS and CMAKE_CXX_FLAGS as this check is very -# costly # + +IF(NOT "${CMAKE_C_FLAGS_SAVED}" STREQUAL "${DEAL_II_C_FLAGS_SAVED}") + UNSET(DEAL_II_HAVE_USABLE_C_FLAGS CACHE) +ENDIF() +SET(DEAL_II_C_FLAGS_SAVED "${CMAKE_C_FLAGS_SAVED}" CACHE INTERNAL "" FORCE) + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS_SAVED}") CHECK_C_SOURCE_COMPILES( "int main(){ return 0; }" DEAL_II_HAVE_USABLE_C_FLAGS) +SET(CMAKE_REQUIRED_FLAGS "") IF(NOT DEAL_II_HAVE_USABLE_C_FLAGS) UNSET(DEAL_II_HAVE_USABLE_C_FLAGS CACHE) @@ -77,7 +82,12 @@ IF(NOT DEAL_II_HAVE_USABLE_C_FLAGS) "${CMAKE_C_FLAGS_SAVED}\n" ) ENDIF() -UNSET(DEAL_II_HAVE_USABLE_C_FLAGS CACHE) + + +IF(NOT "${CMAKE_CXX_FLAGS_SAVED}" STREQUAL "${DEAL_II_CXX_FLAGS_SAVED}") + UNSET(DEAL_II_HAVE_USABLE_CXX_FLAGS CACHE) +ENDIF() +SET(DEAL_II_CXX_FLAGS_SAVED "${CMAKE_CXX_FLAGS_SAVED}" CACHE INTERNAL "" FORCE) SET(CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS_SAVED}") CHECK_CXX_SOURCE_COMPILES( @@ -92,7 +102,7 @@ IF(NOT DEAL_II_HAVE_USABLE_CXX_FLAGS) "${CMAKE_CXX_FLAGS_SAVED}\n" ) ENDIF() -UNSET(DEAL_II_HAVE_USABLE_CXX_FLAGS CACHE) + # # CMAKE_C_COMPILER and CMAKE_CXX_COMPILER have to be of the same brand.