Skip to content

Commit 451440c

Browse files
authored
CMake: Try FindBLAS if no other information was provided (#2104)
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
1 parent 238635c commit 451440c

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

CMakeLists.txt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,18 @@ if(${BLAS} STREQUAL "MKL" OR DEFINED ENV{MKLROOT})
153153
CACHE STRING "")
154154
endif()
155155
elseif(NOT DEFINED ENV{BLAS_LIBS} AND NOT DEFINED ENV{BLAS_CFLAGS})
156-
set(BLAS_INCLUDE_DIRS
157-
""
158-
CACHE STRING "")
159-
set(BLAS_LIBRARIES
160-
-lcblas
161-
CACHE STRING "")
156+
# if nothing is specified via environment variables, let's try FindBLAS
157+
find_package(BLAS)
158+
if(NOT BLAS_FOUND)
159+
# Nothing specified by the user and FindBLAS didn't find anything; let's try
160+
# if cblas is available on the system paths.
161+
set(BLAS_INCLUDE_DIRS
162+
""
163+
CACHE STRING "")
164+
set(BLAS_LIBRARIES
165+
-lcblas
166+
CACHE STRING "")
167+
endif()
162168
endif()
163169
add_compile_definitions(AMICI_BLAS_${BLAS})
164170

0 commit comments

Comments
 (0)