Explorar o código

FindBLAS: Add dependency of OpenBLAS on OpenMP for BLA_STATIC

Fixes: #16221
Eisuke Kawashima %!s(int64=5) %!d(string=hai) anos
pai
achega
f7f3d8987a
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      Modules/FindBLAS.cmake

+ 7 - 1
Modules/FindBLAS.cmake

@@ -586,16 +586,22 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All")
     else()
       find_package(Threads REQUIRED)
     endif()
+    set(_threadlibs "${CMAKE_THREAD_LIBS_INIT}")
+    if(BLA_STATIC)
+      find_package(OpenMP COMPONENTS C)
+      list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}")
+    endif()
     check_blas_libraries(
       BLAS_LIBRARIES
       BLAS
       sgemm
       ""
       "openblas"
-      "${CMAKE_THREAD_LIBS_INIT}"
+      "${_threadlibs}"
       ""
       ""
       )
+    unset(_threadlibs)
   endif()
 endif()