Check BLAS/LAPACK libraries at configure time #795
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are 4 ways simbody finds BLAS/LAPACK libraries:
WINDOWS_USE_EXTERNAL_LIBS=OFF AND BUILD_USING_OTHER_LAPACK=""
) is a set of simbody vendored BLAS/LAPACK librariesWINDOWS_USE_EXTERNAL_LIBS=ON
, then the system BLAS/LAPACK is used (whatever is found by CMake FindBlas and FindLapack)BUILD_USING_OTHER_LAPACK=""
) is the system BLAS/LAPACK (whatever is found by CMake FindBlas and FindLapack)BUILD_USING_OTHER_LAPACK
This could fail any number of ways (especially when using
BUILD_USING_OTHER_LAPACK
), so itwould be helpful to fail as early as possible if there is a problem. Currently, a build with
a poorly specified
BUILD_USING_OTHER_LAPACK
won't fail until linking the SimTKcommonlibrary, after building approximately 1/3 of Simbody.
This PR adds a
try_compile
check that try's to link to the chosen BLAS/LAPACK libraries.If it fails, a helpful error message is printed by CMake:
You can locally test this with either of these (valid) configurations (on Linux):
cmake -B build -S . --fresh
cmake -B build -S . --fresh -DBUILD_USING_OTHER_LAPACK="-lblas;-llapack"
This should fail:
cmake -B build -S . --fresh -DBUILD_USING_OTHER_LAPACK="-lnotablas"
Note: This does not change any generated CMakefiles, and it won't break anything that isn't/wouldn't already be broken.
This change is