I am trying to figure out during configure time if the BLAS I find (ubuntu-20.04) is from Intel MKL, or some other vendor.
find_package(BLAS REQUIRED)
try_compile(
test_use_mkl ${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/test_include_mkl.cpp
LINK_LIBRARIES BLAS::BLAS OUTPUT_VARIABLE test_out)
message(STATUS "Using Intel MKL: ${test_use_mkl } ${test_out}")
During configuration I get:
– Found BLAS: /usr/lib/x86_64-linux-gnu/libmkl_intel_lp64.so;/usr/lib/x86_64-linux-gnu/libmkl_intel_thread.so;/usr/lib/x86_64-linux-gnu/libmkl_core.so;/usr/lib/x86_64-linux-gnu/libiomp5.so;-lpthread;-lm;-ldl
– Using Intel MKL: FALSE Change Dir: /home/lloyd/src/VegaFEM/CIBuild/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make -f Makefile cmTC_fdefb/fast && /usr/bin/make -f CMakeFiles/cmTC_fdefb.dir/build.make CMakeFiles/cmTC_fdefb.dir/build
make[1]: Entering directory ‘/home/lloyd/src/VegaFEM/CIBuild/CMakeFiles/CMakeTmp’
Building CXX object CMakeFiles/cmTC_fdefb.dir/test_include_mkl.cpp.o
/usr/bin/c++ -std=c++14 -o CMakeFiles/cmTC_fdefb.dir/test_include_mkl.cpp.o -c /home/lloyd/src/VegaFEM/cmake/test_include_mkl.cpp
/home/lloyd/src/VegaFEM/cmake/test_include_mkl.cpp:1:10: fatal error: mkl_blas.h: No such file or directory
How can I use try_compile
with an imported target? Can I get the include directories from the target BLAS::BLAS
?