Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When USE_LAPACK is false, do not link against LAPACK #263

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading