Skip to content

Commit 2c5be30

Browse files
committed
Fix OpenMP linking
1 parent 9472538 commit 2c5be30

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

flang-rt/cmake/modules/AddFlangRTOffload.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ macro(enable_cuda_compilation name files)
6060
endif()
6161
endmacro()
6262

63-
macro(enable_omp_offload_compilation files)
63+
macro(enable_omp_offload_compilation name files)
6464
if (FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "OpenMP")
6565
# OpenMP offload build only works with Clang compiler currently.
6666

@@ -108,6 +108,7 @@ macro(enable_omp_offload_compilation files)
108108
set_source_files_properties(${files} PROPERTIES COMPILE_OPTIONS
109109
"${OMP_COMPILE_OPTIONS}"
110110
)
111+
target_link_options(${name} PUBLIC ${OMP_COMPILE_OPTIONS})
111112

112113
# Enable "declare target" in the source code.
113114
set_source_files_properties(${files}

flang-rt/lib/flang_rt/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ if (NOT WIN32)
123123
)
124124

125125
enable_cuda_compilation(flang_rt "${supported_sources}")
126-
enable_omp_offload_compilation("${supported_sources}")
126+
enable_omp_offload_compilation(flang_rt "${supported_sources}")
127127

128128
# For unittests that depend on flang_rt. Should link to the static version
129129
# of the library.
@@ -148,7 +148,7 @@ else()
148148
)
149149

150150
enable_cuda_compilation(${name} "${supported_sources}")
151-
enable_omp_offload_compilation("${supported_sources}")
151+
enable_omp_offload_compilation(${name} "${supported_sources}")
152152
endfunction ()
153153

154154
add_win_flangrt_library(STATIC static MultiThreaded)

0 commit comments

Comments
 (0)