From 24d9c537c0d589cfd1b46f9ccf65d765d93ff953 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 24 Jul 2019 16:01:46 -0400 Subject: [PATCH] only search for LAPACK when building in static mode and when it is not needed for something else --- cmake/CMakeLists.txt | 3 +-- cmake/Modules/Packages/USER-PLUMED.cmake | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0f99cc6274..2fa3170415 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -219,8 +219,7 @@ if(BUILD_OMP) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") endif() - -if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-PLUMED OR PKG_USER-QUIP OR PKG_LATTE) +if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE) find_package(LAPACK) find_package(BLAS) if(NOT LAPACK_FOUND OR NOT BLAS_FOUND) diff --git a/cmake/Modules/Packages/USER-PLUMED.cmake b/cmake/Modules/Packages/USER-PLUMED.cmake index 500558fc72..f71d59901d 100644 --- a/cmake/Modules/Packages/USER-PLUMED.cmake +++ b/cmake/Modules/Packages/USER-PLUMED.cmake @@ -6,6 +6,12 @@ if(PKG_USER-PLUMED) validate_option(PLUMED_MODE PLUMED_MODE_VALUES) string(TOUPPER ${PLUMED_MODE} PLUMED_MODE) + if((PLUMED_MODE STREQUAL "STATIC") AND NOT LAPACK_LIBRARIES) + find_package(LAPACK REQUIRED) + find_package(BLAS REQUIRED) + list(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES}) + endif() + find_package(PkgConfig QUIET) set(DOWNLOAD_PLUMED_DEFAULT ON) if(PKG_CONFIG_FOUND)