From ea180cd1ec4cc1501496ef68520c9ecae48376f5 Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 21 Nov 2023 09:38:30 +0100 Subject: [PATCH] [cmake] Added --no-as-needed link flag for MKL. Otherwise required MKL libraries get stripped out (only libmkl_intel_lp64.so shows up in ldd). --- MathLib/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MathLib/CMakeLists.txt b/MathLib/CMakeLists.txt index fbf64644403..80187fb711c 100644 --- a/MathLib/CMakeLists.txt +++ b/MathLib/CMakeLists.txt @@ -36,6 +36,10 @@ target_link_libraries( Eigen3::Eigen $<$:OpenMP::OpenMP_CXX> ) +if(OGS_USE_MKL AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # Otherwise required MKL libs get stripped out (don't show up in ldd): + target_link_options(MathLib PUBLIC "LINKER:--no-as-needed") +endif() if(OGS_USE_LIS) target_include_directories(MathLib PUBLIC ${LIS_INCLUDE_DIR})