Skip to content

Commit 453b9e4

Browse files
authored
Merge pull request #4961 from h-vetinari/flang
explicitly link to OpenMP
2 parents c634114 + d3272e5 commit 453b9e4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ endif()
102102

103103
message(WARNING "CMake support is experimental. It does not yet support all build options and may not produce the same Makefiles that OpenBLAS ships with.")
104104

105+
if (USE_OPENMP)
106+
find_package(OpenMP REQUIRED)
107+
endif ()
108+
105109
include("${PROJECT_SOURCE_DIR}/cmake/utils.cmake")
106110
include("${PROJECT_SOURCE_DIR}/cmake/system.cmake")
107111

@@ -258,6 +262,15 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "AIX|Android|Linux|FreeBSD|OpenBSD|NetBSD|Drago
258262
endif()
259263
endif()
260264

265+
if (USE_OPENMP)
266+
if(BUILD_STATIC_LIBS)
267+
target_link_libraries(${OpenBLAS_LIBNAME}_static OpenMP::OpenMP_C)
268+
endif()
269+
if(BUILD_SHARED_LIBS)
270+
target_link_libraries(${OpenBLAS_LIBNAME}_shared OpenMP::OpenMP_C)
271+
endif()
272+
endif()
273+
261274
# Seems that this hack doesn't required since macOS 11 Big Sur
262275
if (APPLE AND BUILD_SHARED_LIBS AND CMAKE_HOST_SYSTEM_VERSION VERSION_LESS 20)
263276
set (CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1)

0 commit comments

Comments
 (0)