"has to be configured to use the same number of bits as deal.II, but "
"found:\n"
" DEAL_II_WITH_64BIT_INDICES = ${DEAL_II_WITH_64BIT_INDICES}\n"
- " TRILINOS_WITH_NO_32BIT_INDICES = ${TRILINOS_WITH_NO_32_BIT_INDICES}\n"
+ " TRILINOS_WITH_NO_32BIT_INDICES = ${TRILINOS_WITH_NO_32_BIT_INDICES}\n"
)
SET(${var} FALSE)
- ENDIF()
+ ENDIF()
#
# Trilinos has to be configured with 64bit indices if deal.II uses unsigned long
IF(TRILINOS_WITH_NO_64BIT_INDICES AND DEAL_II_WITH_64BIT_INDICES)
MESSAGE(STATUS "deal.II was configured to use 64bit global indices but "
"Trilinos was not."
- )
+ )
SET(TRILINOS_ADDITIONAL_ERROR_STRING
${TRILINOS_ADDITIONAL_ERROR_STRING}
"The Trilinos installation (found at \"${TRILINOS_DIR}\")\n"
"has to be configured to use the same number of bits as deal.II, but "
"found:\n"
" DEAL_II_WITH_64BIT_INDICES = ${DEAL_II_WITH_64BIT_INDICES}\n"
- " TRILINOS_WITH_NO_64BIT_INDICES = ${TRILINOS_WITH_NO_64_BIT_INDICES}\n"
+ " TRILINOS_WITH_NO_64BIT_INDICES = ${TRILINOS_WITH_NO_64_BIT_INDICES}\n"
)
SET(${var} FALSE)
- ENDIF()
-
+ ENDIF()
#
# Some versions of Sacado_cmath.hpp do things that aren't compatible
# with the -std=c++0x flag of GCC, see deal.II FAQ.
# Test whether that is indeed the case
#
- IF(${var})
- LIST(APPEND 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(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 \"${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()
+ IF(DEAL_II_CAN_USE_CXX11 AND NOT TRILINOS_SUPPORTS_CPP11)
- RESET_CMAKE_REQUIRED()
-
- #
- # Remove the following variables from the cache to force a recheck:
- #
- UNSET(TRILINOS_SUPPORTS_CPP11 CACHE)
- UNSET(TRILINOS_HAS_C99_TR1_WORKAROUND CACHE)
+ 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 \"${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(TRILINOS_FOUND)
MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL)
- #
- # *Boy* Sanitize the include paths given by TrilinosConfig.cmake...
- #
- STRING(REGEX REPLACE
- "(lib64|lib)\\/cmake\\/Trilinos\\/\\.\\.\\/\\.\\.\\/\\.\\.\\/" ""
- TRILINOS_INCLUDE_DIRS "${TRILINOS_INCLUDE_DIRS}"
- )
INCLUDE_DIRECTORIES(${TRILINOS_INCLUDE_DIRS})
#
# This module exports:
#
-# TRILINOS_DIR (cached)
+# TRILINOS_DIR
# TRILINOS_INCLUDE_DIRS
# TRILINOS_LIBRARIES
# TRILINOS_VERSION
# TRILINOS_VERSION_MINOR
# TRILINOS_VERSION_SUBMINOR
# TRILINOS_WITH_MPI
+# TRILINOS_SUPPORTS_CPP11
+# TRILINOS_HAS_C99_TR1_WORKAROUND
#
INCLUDE(FindPackageHandleStandardArgs)
SET_IF_EMPTY(TRILINOS_DIR "$ENV{TRILINOS_DIR}")
#
-# Include the trilinos package configuration:
+# Do not include TrilinosConfig.cmake directly, it is just too big o_O
#
-FIND_PACKAGE(TRILINOS_CONFIG
- CONFIG QUIET
- NAMES Trilinos TRILINOS
+# Just search for the file:
+#
+FIND_FILE(TRILINOS_CONFIG
+ NAMES TrilinosConfig.cmake trilinos-config.cmake
HINTS
- ${TRILINOS_DIR}/lib/cmake/Trilinos
${TRILINOS_DIR}
PATH_SUFFIXES
lib64/cmake/Trilinos
NO_SYSTEM_ENVIRONMENT_PATH
)
-SET(TRILINOS_INCLUDE_DIRS ${Trilinos_INCLUDE_DIRS})
+IF(NOT "${TRILINOS_CONFIG}" STREQUAL "${TRILINOS_CONFIG_SAVED}")
+ SET(_new_trilinos_config TRUE)
+ENDIF()
+SET(TRILINOS_CONFIG_SAVED "${TRILINOS_CONFIG}" CACHE INTERNAL "" FORCE)
+
+
+IF(NOT TRILINOS_CONFIG MATCHES "-NOTFOUND")
+
+ SET(_filtered_trilinos_config
+ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TrilinosConfig.cmake"
+ )
+
+ IF(_new_trilinos_config)
+ GET_FILENAME_COMPONENT(_trilinos_path "${TRILINOS_CONFIG}" PATH)
+ FILE(WRITE ${_filtered_trilinos_config} "SET(_cmake_current_list_dir ${_trilinos_path})\n")
+
+ #
+ # Only pick up every line that starts with "^SET("...
+ #
+ FILE(STRINGS "${TRILINOS_CONFIG}" _trilinos_config_filtered REGEX "^SET")
+
+ FOREACH(_line ${_trilinos_config_filtered})
+ STRING(REPLACE "CMAKE_CURRENT_LIST_DIR" "_cmake_current_list_dir"
+ _line "${_line}"
+ )
+ FILE(APPEND ${_filtered_trilinos_config} "${_line}\n")
+ ENDFOREACH()
+ ENDIF()
+
+ #
+ # ... and include only that:
+ #
+ INCLUDE(${_filtered_trilinos_config})
+
+ SET(TRILINOS_CONFIG_FOUND TRUE)
+ENDIF()
+
+
+#
+# Look for the one include file that we'll query for further information:
+#
+IF(_new_trilinos_config)
+ UNSET(EPETRA_CONFIG_H CACHE)
+ENDIF()
+FIND_FILE(EPETRA_CONFIG_H Epetra_config.h
+ HINTS ${Trilinos_INCLUDE_DIRS}
+ NO_DEFAULT_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_CMAKE_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH
+ NO_CMAKE_FIND_ROOT_PATH
+ )
+IF(EPETRA_CONFIG_H MATCHES "-NOTFOUND")
+ SET(TRILINOS_CONFIG_FOUND FALSE)
+ELSE()
+ SET(TRILINOS_INCLUDE_DIRS ${Trilinos_INCLUDE_DIRS})
+ #
+ # *Boy* Sanitize the include paths given by TrilinosConfig.cmake...
+ #
+ STRING(REGEX REPLACE
+ "(lib64|lib)\\/cmake\\/Trilinos\\/\\.\\.\\/\\.\\.\\/\\.\\.\\/" ""
+ TRILINOS_INCLUDE_DIRS "${TRILINOS_INCLUDE_DIRS}"
+ )
+ENDIF()
+
#
# We'd like to have the full library names but the Trilinos package only
# So we check again for every lib and store the full path:
#
FOREACH(_library ${Trilinos_LIBRARIES})
+ IF(_new_trilinos_config)
+ UNSET(TRILINOS_LIBRARY_${_library} CACHE)
+ ENDIF()
+
FIND_LIBRARY(TRILINOS_LIBRARY_${_library}
NAMES ${_library}
HINTS ${Trilinos_LIBRARY_DIRS}
NO_CMAKE_FIND_ROOT_PATH
)
- LIST(APPEND TRILINOS_LIBRARIES ${TRILINOS_LIBRARY_${_library}})
-
- #
- # Remove the variables from the cache, so that updating TRILINOS_DIR will
- # find the new libraries..
- #
- UNSET(TRILINOS_LIBRARY_${_library} CACHE)
+ IF(TRILINOS_LIBRARY_${_library} MATCHES "-NOTFOUND")
+ SET(TRILINOS_CONFIG_FOUND FALSE)
+ ELSE()
+ LIST(APPEND TRILINOS_LIBRARIES ${TRILINOS_LIBRARY_${_library}})
+ ENDIF()
ENDFOREACH()
#
#
# Determine whether Trilinos was configured with MPI and 64bit indices:
#
- FIND_FILE(EPETRA_CONFIG_H Epetra_config.h
- HINTS ${TRILINOS_INCLUDE_DIRS}
- NO_DEFAULT_PATH
- NO_CMAKE_ENVIRONMENT_PATH
- NO_CMAKE_PATH
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH
- NO_CMAKE_FIND_ROOT_PATH
- )
FILE(STRINGS "${EPETRA_CONFIG_H}" EPETRA_MPI_STRING
REGEX "#define HAVE_MPI")
IF("${EPETRA_MPI_STRING}" STREQUAL "")
SET(TRILINOS_WITH_NO_64BITS_INDICES FALSE)
ENDIF()
- UNSET(EPETRA_CONFIG_H CACHE)
+ #
+ # Some versions of Sacado_cmath.hpp do things that aren't compatible
+ # with the -std=c++0x flag of GCC, see deal.II FAQ.
+ # Test whether that is indeed the case:
+ #
+ IF(_new_trilinos_config)
+ UNSET(TRILINOS_SUPPORTS_CPP11 CACHE)
+ UNSET(TRILINOS_HAS_C99_TR1_WORKAROUND CACHE)
+ ENDIF()
+
+ LIST(APPEND 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
+ )
+
+ #
+ # 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
+ )
+
+ RESET_CMAKE_REQUIRED()
+
MARK_AS_ADVANCED(TRILINOS_DIR)
+
ELSE()
+
SET(TRILINOS_DIR "" CACHE PATH
"An optional hint to a Trilinos installation"
)