]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
CMake: Resolve a cache invalidation problem with the tests for trilinos
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 4 Apr 2013 09:12:12 +0000 (09:12 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 4 Apr 2013 09:12:12 +0000 (09:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@29178 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/configure/configure_trilinos.cmake

index 90b5c2760e736bf9af85a453b1380325a6e523bc..89f15e33ffa6ec1b6b68572dc9ce5314f17d1842 100644 (file)
@@ -112,61 +112,64 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var)
       SET(${var} FALSE)
     ENDIF()
 
+
     #
     # Some verions of Sacado_cmath.hpp does things that aren't compatible
     # with the -std=c++0x flag of GCC, see deal.II FAQ.
     # Test whether that is indeed the case
     #
-    SET(CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIRS})
-    PUSH_TEST_FLAG("${DEAL_II_CXX11_FLAG}")
-
-    CHECK_CXX_SOURCE_COMPILES(
-      "
-      #include <Sacado_cmath.hpp>
-      int main(){ return 0; }
-      "
-      TRILINOS_SUPPORTS_CPP11)
+    IF(${var})
+      SET(CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIRS})
+      PUSH_TEST_FLAG("${DEAL_II_CXX11_FLAG}")
 
-    IF(DEAL_II_CAN_USE_CXX11 AND NOT TRILINOS_SUPPORTS_CPP11)
-      #
-      # Try whether exporting HAS_C99_TR1_CMATH helps:
-      #
-      PUSH_TEST_FLAG("-DHAS_C99_TR1_CMATH")
       CHECK_CXX_SOURCE_COMPILES(
         "
         #include <Sacado_cmath.hpp>
         int main(){ return 0; }
         "
-        TRILINOS_HAS_C99_TR1_WORKAROUND)
-      POP_TEST_FLAG()
-
-      IF(TRILINOS_HAS_C99_TR1_WORKAROUND)
-        LIST(APPEND DEAL_II_DEFINITIONS "HAS_C99_TR1_CMATH")
-        LIST(APPEND DEAL_II_USER_DEFINITIONS "HAS_C99_TR1_CMATH")
-      ELSE()
-        MESSAGE(STATUS "Could not find a sufficient Trilinos installation: "
-          "The installation is not compatible with the C++ standard selected for "
-          "this compiler."
-          )
-        SET(TRILINOS_ADDITIONAL_ERROR_STRING
-          ${TRILINOS_ADDITIONAL_ERROR_STRING}
-          "The Trilinos installation found at\n"
-          "  ${TRILINOS_DIR}\n"
-          "is not compatible with the C++ standard selected for\n"
-          "this compiler. See the deal.II FAQ page for a solution.\n\n"
-          )
-        SET(${var} FALSE)
+        TRILINOS_SUPPORTS_CPP11)
+
+      IF(DEAL_II_CAN_USE_CXX11 AND NOT TRILINOS_SUPPORTS_CPP11)
+        #
+        # Try whether exporting HAS_C99_TR1_CMATH helps:
+        #
+        PUSH_TEST_FLAG("-DHAS_C99_TR1_CMATH")
+        CHECK_CXX_SOURCE_COMPILES(
+          "
+          #include <Sacado_cmath.hpp>
+          int main(){ return 0; }
+          "
+          TRILINOS_HAS_C99_TR1_WORKAROUND)
+        POP_TEST_FLAG()
+
+        IF(TRILINOS_HAS_C99_TR1_WORKAROUND)
+          LIST(APPEND DEAL_II_DEFINITIONS "HAS_C99_TR1_CMATH")
+          LIST(APPEND DEAL_II_USER_DEFINITIONS "HAS_C99_TR1_CMATH")
+        ELSE()
+          MESSAGE(STATUS "Could not find a sufficient Trilinos installation: "
+            "The installation is not compatible with the C++ standard selected for "
+            "this compiler."
+            )
+          SET(TRILINOS_ADDITIONAL_ERROR_STRING
+            ${TRILINOS_ADDITIONAL_ERROR_STRING}
+            "The Trilinos installation found at\n"
+            "  ${TRILINOS_DIR}\n"
+            "is not compatible with the C++ standard selected for\n"
+            "this compiler. See the deal.II FAQ page for a solution.\n\n"
+            )
+          SET(${var} FALSE)
+        ENDIF()
       ENDIF()
-    ENDIF()
 
-    POP_TEST_FLAG()
-    SET(CMAKE_REQUIRED_INCLUDES)
+      POP_TEST_FLAG()
+      SET(CMAKE_REQUIRED_INCLUDES)
 
-    #
-    # Remove the following variables from the cache to force a recheck:
-    #
-    UNSET(TRILINOS_SUPPORTS_CPP11 CACHE)
-    UNSET(TRILINOS_HAS_C99_TR1_WORKAROUND CACHE)
+      #
+      # Remove the following variables from the cache to force a recheck:
+      #
+      UNSET(TRILINOS_SUPPORTS_CPP11 CACHE)
+      UNSET(TRILINOS_HAS_C99_TR1_WORKAROUND CACHE)
+    ENDIF()
 
   ENDIF(TRILINOS_FOUND)
 ENDMACRO()

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.