File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,13 @@ macro(enable_omp_offload_compilation name files)
105
105
set_source_files_properties (${files}
106
106
PROPERTIES COMPILE_DEFINITIONS OMP_OFFLOAD_BUILD
107
107
)
108
+
109
+ # If building flang-rt together with libomp, ensure that libomp is built first and found because -fopenmp will try to link it.
110
+ if (TARGET omp )
111
+ add_dependencies (${name} omp )
112
+ target_link_options (${name} .static PUBLIC "-L$<TARGET_FILE_DIR:omp>" )
113
+ #target_link_libraries(${name}.static PRIVATE omp)
114
+ endif ()
108
115
else ()
109
116
message (FATAL_ERROR
110
117
"Flang-rt build with OpenMP offload is not supported for these compilers:\n "
Original file line number Diff line number Diff line change @@ -53,10 +53,9 @@ function(add_flangrt_unittest_offload_properties target)
53
53
# FIXME: replace 'native' in --offload-arch option with the list
54
54
# of targets that Fortran Runtime was built for.
55
55
if (FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "OpenMP" )
56
- set_target_properties (${target}
57
- PROPERTIES LINK_OPTIONS
58
- "-fopenmp;--offload-arch=native"
59
- )
56
+ set_property (TARGET ${target} APPEND
57
+ PROPERTY LINK_OPTIONS "-fopenmp;--offload-arch=native"
58
+ )
60
59
endif ()
61
60
endfunction ()
62
61
You can’t perform that action at this time.
0 commit comments