find_library: Does not use prefixes from PATH on UNIX
Hello,
I have an issue with FindBLAS, but it looks more as an issue with find_library behavior. I attach my minimal CMakeLists.txt config file to highlight the issue. CMakeLists.txt
Here is my environment:
% sudo find / -name "libblas.a" 2> /dev/null
/opt/myblas-static/lib/libblas.a
/usr/lib/x86_64-linux-gnu/libblas.a
/usr/lib/x86_64-linux-gnu/blas/libblas.a
% sudo find / -name "libblas.so" 2> /dev/null
/opt/myblas-dyn/lib/libblas.so
/usr/lib/x86_64-linux-gnu/libblas.so
/usr/lib/x86_64-linux-gnu/blas/libblas.so
% env | grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/opt/myblas-dyn/lib
So, I'm expecting to find by default my own blas library as defined by my environment. Unfortunately, cmake always returns the library from the systems instead of the one I define through my environment variable.
Here is the output of the messages:
-- BLAS_LIBRARIES: /usr/lib/x86_64-linux-gnu/libblas.so
-- TEST_blaspath_LIBRARY: /usr/lib/x86_64-linux-gnu/libblas.so
-- TEST_blashint_LIBRARY: /opt/myblas-dyn/lib/libblas.so
Using HINTS is the only solution I found to make it discover the library in the default path.
I'm using cmake 3.16.3
Edited by Brad King