Skip to content

Commit a203645

Browse files
committed
Add findBLAS support to CMakeLists.txt
1 parent 6d9d7fd commit a203645

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ if(NOT DEFINED CMAKE_MAXIMUM_RANK)
4242
set(CMAKE_MAXIMUM_RANK 4 CACHE STRING "Maximum array rank for generated procedures")
4343
endif()
4444

45+
# --- find BLAS and LAPACK
46+
find_package(BLAS)
47+
if(BLAS_FOUND)
48+
add_compile_definitions(STDLIB_EXTERNAL_BLAS)
49+
endif()
50+
find_package(LAPACK)
51+
if(LAPACK_FOUND)
52+
add_compile_definitions(STDLIB_EXTERNAL_LAPACK)
53+
endif()
54+
4555
# --- find preprocessor
4656
find_program(FYPP fypp)
4757
if(NOT FYPP)

src/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ set(SRC
120120

121121
add_library(${PROJECT_NAME} ${SRC})
122122

123+
# Link to BLAS and LAPACK
124+
if(BLAS_FOUND)
125+
target_link_libraries(${PROJECT_NAME} BLAS::BLAS)
126+
endif()
127+
if(LAPACK_FOUND)
128+
target_link_libraries(${PROJECT_NAME} LAPACK::LAPACK)
129+
endif()
130+
123131
set_target_properties(
124132
${PROJECT_NAME}
125133
PROPERTIES

0 commit comments

Comments
 (0)