Skip to content

Commit 0450959

Browse files
committed
Fix default targets ALIAS
1 parent a2eda09 commit 0450959

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

flang-rt/cmake/modules/AddFlangRT.cmake

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,21 @@ function (add_flangrt_library name)
146146
if (libtargets)
147147
if (BUILD_SHARED_LIBS)
148148
if (build_shared)
149-
add_library(${name}.default ALIAS ${name_shared})
149+
set(default_target "${name_shared}")
150150
else ()
151-
add_library(${name}.default ALIAS ${name_static})
151+
set(default_target "${name_static}")
152152
endif ()
153153
else ()
154154
if (build_static)
155-
add_library(${name}.default ALIAS ${name_static})
155+
set(default_target "${name_static}")
156156
else ()
157-
add_library(${name}.default ALIAS ${name_shared})
157+
set(default_target "${name_shared}")
158158
endif ()
159159
endif ()
160+
add_library(${name}.default ALIAS "${default_target}")
161+
if (NOT TARGET ${name})
162+
add_library(${name} ALIAS "${default_target}")
163+
endif ()
160164
endif ()
161165

162166
foreach (tgtname IN LISTS libtargets)

flang-rt/cmake/modules/AddFlangRTOffload.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
macro(enable_cuda_compilation name files)
1010
if (FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "CUDA")
11-
if (NOT FLANG_RT_ENABLE_STATIC)
11+
if (FLANG_RT_ENABLE_SHARED)
1212
message(FATAL_ERROR
13-
"FLANG_RT_ENABLE_STATIC is required for CUDA build of Flang-RT"
13+
"FLANG_RT_ENABLE_SHARED is not supported for CUDA offload build of Flang-RT"
1414
)
1515
endif()
1616

1717
enable_language(CUDA)
1818

19-
set_target_properties(${name}
19+
set_target_properties(${name}.static
2020
PROPERTIES
2121
CUDA_SEPARABLE_COMPILATION ON
2222
)
@@ -61,7 +61,7 @@ macro(enable_cuda_compilation name files)
6161
# When using libcudacxx headers files, we have to use them
6262
# for all files of Flang-RT.
6363
if (EXISTS "${FLANG_RT_LIBCUDACXX_PATH}/include")
64-
foreach (tgt IN ITEMS "${name}" "obj.${name}PTX")
64+
foreach (tgt IN ITEMS "${name}.static" "obj.${name}PTX")
6565
target_include_directories(${tgt} AFTER PRIVATE "${FLANG_RT_LIBCUDACXX_PATH}/include")
6666
target_compile_definitions(${tgt} PRIVATE RT_USE_LIBCUDACXX=1)
6767
endforeach ()

flang-rt/lib/flang_rt/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ if (NOT WIN32)
139139

140140
# Select a default runtime, which is used for unit and regression tests.
141141
get_target_property(default_target flang_rt.default ALIASED_TARGET)
142-
add_library(flang_rt ALIAS "${default_target}")
143142
add_library(flang_rt.unittest ALIAS "${default_target}")
144143
else()
145144
# Target for building all versions of the runtime

0 commit comments

Comments
 (0)