Skip to content

Commit

Permalink
When USE_LAPACK is false, do not link against LAPACK (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmusolino authored May 2, 2024
1 parent fd0e6ec commit 697e647
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 697e647

Please sign in to comment.