]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Introduce the same caching method for the sanity checks
authorMatthias Maier <tamiko@kyomu.43-1.org>
Fri, 5 Apr 2013 09:19:20 +0000 (09:19 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Fri, 5 Apr 2013 09:19:20 +0000 (09:19 +0000)
git-svn-id: https://svn.dealii.org/trunk@29200 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/setup_compiler_flags.cmake

index b8bbda698436b637d5262b7da9691ec99fff3f8c..db784362b44d4333fec714a7880a4fbf334df0dd 100644 (file)
 
 #
 # 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.

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.