cvxgrp / scs

Splitting Conic Solver
MIT License
553 stars 136 forks source link

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

Closed nmusolino closed 6 months ago

nmusolino commented 6 months ago

In a recent pull request (https://github.com/cvxgrp/scs/pull/257), we added USE_LAPACK as a CMake-level variable controlling whetherUSE_LAPACK is defined during C compilation.

Unfortunately, that pull request failed to update the link-time dependencies of the libscsdir and libscsindir targets. This PR fixes the target_link_libraries() declarations to link against blas and lapack if and only if USE_LAPACK is true.

nmusolino commented 6 months ago

To test this, I confirmed that, when configuring with USE_LAPACK=1, the build process continues to compile with -DUSE_LAPACK and link with -lm -lblas -llapack, as currently.

When configuring with USE_LAPACK=0:

cmake -S . -B ./build0 -D USE_LAPACK=0 && (cd ./build0 && make VERBOSE=1 all)

the build process does not use USE_LAPACK=1 and links with only -lm.

nmusolino commented 6 months ago

@bodono , I contributed #257 in October 2023, but unfortunately that MR had an omission (failed to set linker options based on USE_LAPACK). This MR fixes that mistake.

bodono commented 6 months ago

Thanks for doing this @nmusolino !