Skip to content

Commit

Permalink
CMake: Try FindBLAS if no other information was provided (#2104)
Browse files Browse the repository at this point in the history
Let CMake's FindBLAS try to find BLAS libraries in case the user didn't provide any other information via environment variables.

Relates to #2103
  • Loading branch information
dweindl authored May 23, 2023
1 parent 238635c commit 451440c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,18 @@ if(${BLAS} STREQUAL "MKL" OR DEFINED ENV{MKLROOT})
CACHE STRING "")
endif()
elseif(NOT DEFINED ENV{BLAS_LIBS} AND NOT DEFINED ENV{BLAS_CFLAGS})
set(BLAS_INCLUDE_DIRS
""
CACHE STRING "")
set(BLAS_LIBRARIES
-lcblas
CACHE STRING "")
# if nothing is specified via environment variables, let's try FindBLAS
find_package(BLAS)
if(NOT BLAS_FOUND)
# Nothing specified by the user and FindBLAS didn't find anything; let's try
# if cblas is available on the system paths.
set(BLAS_INCLUDE_DIRS
""
CACHE STRING "")
set(BLAS_LIBRARIES
-lcblas
CACHE STRING "")
endif()
endif()
add_compile_definitions(AMICI_BLAS_${BLAS})

Expand Down

0 comments on commit 451440c

Please sign in to comment.