From b9ef207d7b2338ecfe698055e46a424f71a0da88 Mon Sep 17 00:00:00 2001 From: maier Date: Thu, 11 Jul 2013 15:24:20 +0000 Subject: [PATCH] CMake: Do it correctly git-svn-id: https://svn.dealii.org/trunk@29969 0785d39b-7218-0410-832d-ea1e28bc413d --- .../cmake/configure/configure_1_lapack.cmake | 77 +++++++++---------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/deal.II/cmake/configure/configure_1_lapack.cmake b/deal.II/cmake/configure/configure_1_lapack.cmake index 5dbd35c580..d822253b30 100644 --- a/deal.II/cmake/configure/configure_1_lapack.cmake +++ b/deal.II/cmake/configure/configure_1_lapack.cmake @@ -19,6 +19,43 @@ MACRO(FEATURE_LAPACK_FIND_EXTERNAL var) FIND_PACKAGE(LAPACK) + # + # 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.. + # + IF(NOT LAPACK_LINKER_FLAGS MATCHES "${BLAS_LINKER_FLAGS}") + MESSAGE(STATUS + "Manually adding BLAS_LINKER_FLAGS to LAPACK_LINKER_FLAGS" + ) + ADD_FLAGS(LAPACK_LINKER_FLAGS "${BLAS_LINKER_FLAGS}") + ENDIF() + IF(NOT "${LAPACK_LIBRARIES}" MATCHES "${BLAS_LIBRARIES}") + MESSAGE(STATUS + "Manually adding BLAS_LIBRARIES to LAPACK_LIBRARIES" + ) + LIST(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES}) + ENDIF() + + # + # Well, in case of static archives we have to manually pick up the + # complete link interface. *sigh* + # + # Do this unconditionally for the most common case: + # TODO: Non-GNU setups... + # + FOREACH(_lib m gfortran quadmath) + FIND_LIBRARY(${_lib}_lib + NAMES ${_lib} + HINTS ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}) + MARK_AS_ADVANCED(${_lib}_lib) + + IF(NOT ${_lib}_lib MATCHES "-NOTFOUND") + LIST(APPEND LAPACK_LIBRARIES ${${_lib}_lib}) + ENDIF() + ENDFOREACH() + + IF(LAPACK_FOUND) MARK_AS_ADVANCED( atlas_LIBRARY @@ -71,49 +108,9 @@ MACRO(RESET_LAPACK_FUNCTIONS_CACHE) ENDFOREACH() ENDMACRO() -# -# Resolve a cache invalidation problem by searching for this flag -# unconditionally. It is used in FEATURE_LAPACK_CONFIGURE_EXTERNAL -# depending on cached variables. -# -ENABLE_IF_LINKS(_dummy "-lgfortran") -ENABLE_IF_LINKS(_dummy "-lquadmath") MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL) - # - # 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.. - # - IF(NOT LAPACK_LINKER_FLAGS MATCHES "${BLAS_LINKER_FLAGS}") - MESSAGE(STATUS - "Manually adding BLAS_LINKER_FLAGS to LAPACK_LINKER_FLAGS" - ) - ADD_FLAGS(LAPACK_LINKER_FLAGS "${BLAS_LINKER_FLAGS}") - ENDIF() - IF(NOT "${LAPACK_LIBRARIES}" MATCHES "${BLAS_LIBRARIES}") - MESSAGE(STATUS - "Manually adding BLAS_LIBRARIES to LAPACK_LIBRARIES" - ) - LIST(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES}) - ENDIF() - - - # - # Well, in case of static archives we have to manually pick up the - # complete link interface. *sigh* - # - # Do this unconditionally for the most common case: - # TODO: Non-GNU setups... - # - IF(NOT m_lib MATCHES "-NOTFOUND") - LIST(APPEND LAPACK_LIBRARIES ${m_lib}) - ENDIF() - - ENABLE_IF_LINKS(LAPACK_LINKER_FLAGS "-lgfortran") - ENABLE_IF_LINKS(LAPACK_LINKER_FLAGS "-lquadmath") - ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}") LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${LAPACK_LIBRARIES}) -- 2.39.5