From 544a308f846795f545fdd1a348182b8f8848b6e2 Mon Sep 17 00:00:00 2001 From: Nicholas Musolino Date: Tue, 30 Apr 2024 13:11:06 -0400 Subject: [PATCH] When USE_LAPACK is false, do not link against LAPACK --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c58f269..90f1eec9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,6 +129,7 @@ option(USE_OPENMP "Compile with OpenMP support" OFF) message(STATUS "OpenMP parallelization is ${USE_OPENMP}") set(COMPILER_OPTS "-DCTRLC") +set(LAPACK_LINK_LIBRARIES "") # Primitive types if(SFLOAT) @@ -155,6 +156,7 @@ endif() if (USE_LAPACK) set(COMPILER_OPTS "-DUSE_LAPACK ${COMPILER_OPTS}") + list(APPEND LAPACK_LINK_LIBRARIES "blas" "lapack") endif() if(USE_OPENMP) @@ -242,8 +244,8 @@ target_include_directories( # Compiled with blas and lapack, can solve LPs, SOCPs, SDPs, ECPs, and PCPs target_compile_definitions(${${PROJECT_NAME}_DIRECT} PRIVATE ${COMPILER_OPTS}) -# The library depends on math (m) blas and lapack -target_link_libraries(${${PROJECT_NAME}_DIRECT} PRIVATE m blas lapack) +# The library depends on math (m) and (optionally) blas and lapack +target_link_libraries(${${PROJECT_NAME}_DIRECT} PRIVATE m ${LAPACK_LINK_LIBRARIES}) # Set some properties set_target_properties( @@ -290,8 +292,8 @@ target_include_directories( target_compile_definitions(${${PROJECT_NAME}_INDIRECT} PRIVATE ${COMPILER_OPTS} -DINDIRECT) -# The library depends on math (m) blas and lapack -target_link_libraries(${${PROJECT_NAME}_INDIRECT} PUBLIC m blas lapack) +# The library depends on math (m) and (optionally) blas and lapack +target_link_libraries(${${PROJECT_NAME}_INDIRECT} PUBLIC m ${LAPACK_LINK_LIBRARIES}) # Set some properties set_target_properties(