1
-
2
1
#/***************************************************************************
3
2
# *
4
3
# * @license
23
22
# * @filename FindSystemBLAS.cmake
24
23
# *
25
24
# **************************************************************************/
26
- set (SystemBLAS_FOUND FALSE )
27
-
28
25
include (FindPackageHandleStandardArgs )
29
26
30
- find_library (OPENBLAS_LIBRARIES NAMES openblas libopenblas )
31
- find_path (OPENBLAS_INCLUDE_DIRS openblas_config.h )
32
- if (OPENBLAS_LIBRARIES AND OPENBLAS_INCLUDE_DIRS )
27
+ # Let user possibility to set blas path to similar libraries like lapack
28
+ if (BLAS_LIBRARIES AND BLAS_INCLUDE_DIRS )
33
29
find_package (Threads REQUIRED )
34
30
add_library (blas::blas UNKNOWN IMPORTED )
35
31
set_target_properties (blas::blas PROPERTIES
36
- INTERFACE_INCLUDE_DIRECTORIES "${OPENBLAS_INCLUDE_DIRS } "
32
+ INTERFACE_INCLUDE_DIRECTORIES "${BLAS_INCLUDE_DIRS } "
37
33
INTERFACE_LINK_LIBRARIES Threads::Threads
38
- IMPORTED_LOCATION "${OPENBLAS_LIBRARIES } "
34
+ IMPORTED_LOCATION "${BLAS_LIBRARIES } "
39
35
)
40
- set (OPENBLAS_FOUND TRUE )
41
- set (SystemBLAS_LIBRARIES OPENBLAS_LIBRARIES )
36
+ set (SystemBLAS_LIBRARIES ${BLAS_LIBRARIES} )
42
37
else ()
38
+ set (BLA_VENDOR OpenBLAS )
43
39
find_package (BLAS QUIET )
40
+ if (BLAS_FOUND )
41
+ set (SystemBLAS_LIBRARIES ${BLAS_LIBRARIES} )
42
+ endif ()
43
+ if (NOT BLAS_FOUND )
44
+ message (WARNING "openBLAS library was not found on your system" )
45
+ unset (BLA_VENDOR )
46
+ set (BLA_VENDOR All )
47
+ find_package (BLAS QUIET )
48
+ if (BLAS_FOUND )
49
+ message (WARNING "Found another BLAS library on your system. Not using openBLAS may cause some tests to fail." )
50
+ message ("-- BLAS library found at ${BLAS_LIBRARIES} " )
51
+ set (SystemBLAS_LIBRARIES ${BLAS_LIBRARIES} )
52
+ endif ()
53
+ endif ()
54
+
44
55
if (NOT BLAS_FOUND )
45
56
set (BLA_STATIC ON )
46
57
find_package (BLAS QUIET )
58
+ set (SystemBLAS_LIBRARIES ${BLAS_LIBRARIES} )
47
59
endif ()
48
60
49
61
if (BLAS_FOUND AND NOT TARGET blas::blas )
@@ -53,12 +65,7 @@ else()
53
65
)
54
66
endif ()
55
67
56
- if (BLAS_FOUND )
57
- set (SystemBLAS_FOUND TRUE )
58
- set (SystemBLAS_LIBRARIES BLAS_LIBRARIES )
59
- endif ()
60
68
endif ()
61
69
62
70
find_package_handle_standard_args (SystemBLAS
63
- FOUND_VAR SystemBLAS_FOUND
64
71
REQUIRED_VARS SystemBLAS_LIBRARIES )
0 commit comments