diff options
author | Brad King <brad.king@kitware.com> | 2021-04-08 11:44:55 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-04-08 11:45:13 (GMT) |
commit | d6a0b24d1011e6f9559c6a8ba1263fa2794fbfb8 (patch) | |
tree | 2902866fd33db3ef4d9596a1e76c1fd609f085c4 | |
parent | f8af94a2124d61e33f71f67b4ae282475314da25 (diff) | |
parent | 9ef82d95d8bab39b354c09139c94a39d49aeab9d (diff) | |
download | CMake-d6a0b24d1011e6f9559c6a8ba1263fa2794fbfb8.zip CMake-d6a0b24d1011e6f9559c6a8ba1263fa2794fbfb8.tar.gz CMake-d6a0b24d1011e6f9559c6a8ba1263fa2794fbfb8.tar.bz2 |
Merge topic 'FindBLAS-default-OpenMP' into release-3.20
9ef82d95d8 FindBLAS: Fix detection of OpenMP as dependency of BLA_STATIC
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5993
-rw-r--r-- | Modules/FindBLAS.cmake | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 4cf812b..b4650b2 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -619,8 +619,17 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") endif() set(_threadlibs "${CMAKE_THREAD_LIBS_INIT}") if(BLA_STATIC) - find_package(OpenMP COMPONENTS C) - list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}") + set(_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}") + set(CMAKE_FIND_LIBRARY_SUFFIXES "${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}") + if (CMAKE_C_COMPILER_LOADED) + find_package(OpenMP COMPONENTS C) + list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}") + elseif(CMAKE_CXX_COMPILER_LOADED) + find_package(OpenMP COMPONENTS CXX) + list(PREPEND _threadlibs "${OpenMP_CXX_LIBRARIES}") + endif() + set(CMAKE_FIND_LIBRARY_SUFFIXES "${_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES}") + unset(_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES) endif() check_blas_libraries( BLAS_LIBRARIES |