From 7805431fb23e10fc62586c893c723e611c11eb9c Mon Sep 17 00:00:00 2001
From: maier
Date: Sun, 31 Mar 2013 23:14:45 +0000
Subject: [PATCH] CMake: Make the custom overrides more robust. Also try to
handle incomplete LAPACK interfaces
git-svn-id: https://svn.dealii.org/trunk@29130 0785d39b-7218-0410-832d-ea1e28bc413d
---
deal.II/cmake/configure/configure_1_lapack.cmake | 11 +++++++++++
deal.II/cmake/macros/macro_find_package.cmake | 9 +++++++--
deal.II/doc/development/cmake.html | 12 +++++-------
3 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/deal.II/cmake/configure/configure_1_lapack.cmake b/deal.II/cmake/configure/configure_1_lapack.cmake
index fb4ff6e4af..301d1532ec 100644
--- a/deal.II/cmake/configure/configure_1_lapack.cmake
+++ b/deal.II/cmake/configure/configure_1_lapack.cmake
@@ -71,6 +71,17 @@ ENDMACRO()
MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL)
ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}")
LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${LAPACK_LIBRARIES})
+
+ #
+ # So, well... LAPACK_LINKER_FLAGS and LAPACK_LIBRARIES should contain the
+ # complete link interface. But for invalid user overrides we include
+ # BLAS_LIBRARIES and BLAS_LINKER_FLAGS as well..
+ #
+ LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${BLAS_LIBRARIES})
+ IF(NOT LAPACK_LINKER_FLAGS MATCHES "${BLAS_LINKER_FLAGS}")
+ ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
+ ENDIF()
+
CHECK_FOR_LAPACK_FUNCTIONS()
ENDMACRO()
diff --git a/deal.II/cmake/macros/macro_find_package.cmake b/deal.II/cmake/macros/macro_find_package.cmake
index 8f6b623f40..01adf7a2bc 100644
--- a/deal.II/cmake/macros/macro_find_package.cmake
+++ b/deal.II/cmake/macros/macro_find_package.cmake
@@ -15,13 +15,18 @@
#
# A small wrapper around FIND_PACKAGE.
# We guard the invocation of FIND_PACKAGE(package <...>) by
-# ${package}_FOUND to allow easy custom overrides
+# ${package}_FOUND and ${package}_LIBRARIES to allow easy custom overrides
#
MACRO(FIND_PACKAGE _package_name)
STRING(TOUPPER ${_package_name} _package_name_uppercase)
- IF(NOT DEFINED ${_package_name_uppercase}_FOUND)
+ IF( NOT DEFINED ${_package_name_uppercase}_FOUND AND
+ NOT DEFINED ${_package_name_uppercase}_LIBRARIES )
_FIND_PACKAGE (${_package_name} ${ARGN})
+ ELSE()
+ IF(NOT DEFINED ${_package_name_uppercase}_FOUND)
+ SET(${_package_name_uppercase}_FOUND TRUE)
+ ENDIF()
ENDIF()
ENDMACRO()
diff --git a/deal.II/doc/development/cmake.html b/deal.II/doc/development/cmake.html
index 242a3f6e55..61b0a0256b 100644
--- a/deal.II/doc/development/cmake.html
+++ b/deal.II/doc/development/cmake.html
@@ -411,16 +411,14 @@
detailed list of valid variables per feature.)
- An example of use is to select BLAS and LAPACK manually as follows
- (here, these libraries have been compiled with the gfortran compiler
+ An example of use is to select BLAS and LAPACK manually from a PETSc
+ configuration:
+ (Here, these libraries have been compiled with the gfortran compiler
and need its support library):
- cmake -DBLAS_FOUND=true \
- -DBLAS_LIBRARIES="/apps/GotoBLAS/lib64/libgoto.so" \
- -DBLAS_LINKER_FLAGS="-lgfortran" \
- -DLAPACK_FOUND=true \
- -DLAPACK_LIBRARIES="/apps/lapack-3.2.1/liblapack.so;/apps/GotoBLAS/lib64/libgoto.so" \
+ cmake -DLAPACK_FOUND=true \
+ -DLAPACK_LIBRARIES="/tmp/petsc-3.3-p6/arch-linux2-c-debug/lib/libflapack.a;/tmp/petsc-3.3-p6/arch-linux2-c-debug/lib/libfblas.a" \
-DLAPACK_LINKER_FLAGS="-lgfortran"
--
2.39.5