From e4474563a3d8878494322c63421d5dc87a523c46 Mon Sep 17 00:00:00 2001 From: maier Date: Sun, 2 Feb 2014 00:10:11 +0000 Subject: [PATCH] CMake: Bugfix: Get the caching right in FindPETSC.cmake and FindTRILINOS.cmake git-svn-id: https://svn.dealii.org/trunk@32372 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/modules/FindPETSC.cmake | 23 ++++++++++++----------- deal.II/cmake/modules/FindTRILINOS.cmake | 8 +++----- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/deal.II/cmake/modules/FindPETSC.cmake b/deal.II/cmake/modules/FindPETSC.cmake index 7bd039a11c..df83255e4d 100644 --- a/deal.II/cmake/modules/FindPETSC.cmake +++ b/deal.II/cmake/modules/FindPETSC.cmake @@ -123,13 +123,18 @@ IF(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND") # Link line: # - FILE(STRINGS "${PETSC_PETSCVARIABLES}" _external_link_line + FILE(STRINGS "${PETSC_PETSCVARIABLES}" PETSC_EXTERNAL_LINK_LINE REGEX "^PETSC_WITH_EXTERNAL_LIB =.*") - SEPARATE_ARGUMENTS(_external_link_line) + SEPARATE_ARGUMENTS(PETSC_EXTERNAL_LINK_LINE) + + IF(NOT "${PETSC_EXTERNAL_LINK_LINE}" STREQUAL "${PETSC_EXTERNAL_LINK_LINE_SAVED}") + SET(_new_petsc_external_link_line TRUE) + ENDIF() + SET(PETSC_EXTERNAL_LINK_LINE_SAVED "${PETSC_EXTERNAL_LINK_LINE}" CACHE INTERNAL "" FORCE) SET(_hints) SET(_petsc_libraries) - FOREACH(_token ${_external_link_line}}) + FOREACH(_token ${PETSC_EXTERNAL_LINK_LINE}}) IF(_token MATCHES "^-L") # Build up hints with the help of all tokens passed with -L: STRING(REGEX REPLACE "^-L" "" _token "${_token}") @@ -138,14 +143,15 @@ IF(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND") # Search for every library that was specified with -l: STRING(REGEX REPLACE "^-l" "" _token "${_token}") + IF(_new_petsc_external_link_line) + UNSET(PETSC_LIBRARY_${_token} CACHE) + ENDIF() + IF(_token MATCHES "^(c|quadmath|gfortran|m|rt|nsl|dl|pthread)$") FIND_SYSTEM_LIBRARY(PETSC_LIBRARY_${_token} NAMES ${_token}) IF(NOT PETSC_LIBRARY_${_token} MATCHES "-NOTFOUND") LIST(APPEND _petsc_libraries ${PETSC_LIBRARY_${_token}}) ENDIF() - # Remove from cache, so that updating PETSC search paths will - # find a (possibly) new link interface - UNSET(PETSC_LIBRARY_${_token} CACHE) ELSEIF(NOT _token MATCHES "(petsc|stdc\\+\\+|gcc_s)") FIND_LIBRARY(PETSC_LIBRARY_${_token} NAMES ${_token} @@ -154,9 +160,6 @@ IF(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND") IF(NOT PETSC_LIBRARY_${_token} MATCHES "-NOTFOUND") LIST(APPEND _petsc_libraries ${PETSC_LIBRARY_${_token}}) ENDIF() - # Remove from cache, so that updating PETSC search paths will - # find a (possibly) new link interface - UNSET(PETSC_LIBRARY_${_token} CACHE) ENDIF() ENDIF() @@ -164,8 +167,6 @@ IF(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND") ENDIF() - - FIND_PACKAGE_HANDLE_STANDARD_ARGS(PETSC DEFAULT_MSG PETSC_LIBRARY PETSC_INCLUDE_DIR_ARCH diff --git a/deal.II/cmake/modules/FindTRILINOS.cmake b/deal.II/cmake/modules/FindTRILINOS.cmake index 877e550f65..b6526cf4a3 100644 --- a/deal.II/cmake/modules/FindTRILINOS.cmake +++ b/deal.II/cmake/modules/FindTRILINOS.cmake @@ -51,10 +51,10 @@ FIND_PACKAGE(TRILINOS_CONFIG NO_SYSTEM_ENVIRONMENT_PATH ) -IF(NOT "${TRILINOS_CONFIG}" STREQUAL "${TRILINOS_CONFIG_SAVED}") +IF(NOT "${TRILINOS_CONFIG_DIR}" STREQUAL "${TRILINOS_CONFIG_DIR_SAVED}") SET(_new_trilinos_config TRUE) ENDIF() -SET(TRILINOS_CONFIG_SAVED "${TRILINOS_CONFIG}" CACHE INTERNAL "" FORCE) +SET(TRILINOS_CONFIG_DIR_SAVED "${TRILINOS_CONFIG_DIR}" CACHE INTERNAL "" FORCE) # @@ -204,17 +204,15 @@ IF(TRILINOS_FOUND) " TRILINOS_HAS_C99_TR1_WORKAROUND ) - RESET_CMAKE_REQUIRED() - MARK_AS_ADVANCED(TRILINOS_DIR) ELSE() SET(TRILINOS_LIBRARIES) SET(TRILINOS_INCLUDE_DIRS) - SET(TRILINOS_CONFIG_SAVED "" CACHE INTERNAL "" FORCE) + UNSET(TRILINOS_CONFIG_DIR_SAVED CACHE) SET(TRILINOS_DIR "" CACHE PATH "An optional hint to a Trilinos installation" -- 2.39.5