From 143f8c9e75ae93d1e3f3044711080a9117c012a2 Mon Sep 17 00:00:00 2001 From: maier Date: Thu, 4 Apr 2013 09:12:12 +0000 Subject: [PATCH] CMake: Resolve a cache invalidation problem with the tests for trilinos git-svn-id: https://svn.dealii.org/trunk@29178 0785d39b-7218-0410-832d-ea1e28bc413d --- .../cmake/configure/configure_trilinos.cmake | 85 ++++++++++--------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/deal.II/cmake/configure/configure_trilinos.cmake b/deal.II/cmake/configure/configure_trilinos.cmake index 90b5c2760e..89f15e33ff 100644 --- a/deal.II/cmake/configure/configure_trilinos.cmake +++ b/deal.II/cmake/configure/configure_trilinos.cmake @@ -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 - 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 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 + 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() -- 2.39.5