File tree Expand file tree Collapse file tree 4 files changed +13
-7
lines changed
examples/ExternalHelloWorld Expand file tree Collapse file tree 4 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -142,8 +142,8 @@ function (add_flangrt_library name)
142
142
add_library ("${name_shared} " SHARED ${extra_args} ${ARG_ADDITIONAL_HEADERS} ${ARG_UNPARSED_ARGUMENTS} )
143
143
endif ()
144
144
145
- # Provide a default target if building both and which exists in either setting.
146
145
if (libtargets )
146
+ # Provide a default alias which exists in either setting.
147
147
if (BUILD_SHARED_LIBS )
148
148
if (build_shared )
149
149
set (default_target "${name_shared} " )
@@ -158,8 +158,14 @@ function (add_flangrt_library name)
158
158
endif ()
159
159
endif ()
160
160
add_library (${name} .default ALIAS "${default_target} " )
161
+
162
+ # Provide a build target that builds any enabled library.
163
+ # Not intended for target_link_libraries. Either use the ${name}.static,
164
+ # ${name}.shared variants, or ${name}.default to let BUILD_SHARED_LIBS
165
+ # decide.
161
166
if (NOT TARGET ${name} )
162
- add_library (${name} ALIAS "${default_target} " )
167
+ add_custom_target (${name} )
168
+ add_dependencies (${name} ${libtargets} )
163
169
endif ()
164
170
endif ()
165
171
Original file line number Diff line number Diff line change @@ -13,5 +13,5 @@ add_llvm_example(external-hello-world
13
13
14
14
target_link_libraries (external-hello-world
15
15
PRIVATE
16
- flang_rt.runtime
16
+ flang_rt.runtime.default
17
17
)
Original file line number Diff line number Diff line change @@ -27,16 +27,16 @@ add_flangrt_library(flang_rt.cuda STATIC SHARED
27
27
28
28
# For the static library, link-in the static dependencies as well.
29
29
if (TARGET flang_rt.cuda.static )
30
- target_link_libraries (flang .cuda.static PUBLIC
30
+ target_link_libraries (flang_rt .cuda.static PUBLIC
31
31
flang_rt.runtime.static
32
32
CUDA::cudart_static
33
33
)
34
34
endif ()
35
35
36
36
# For the shared library, use the shared versions of the dependencies.
37
37
if (TARGET flang_rt.cuda.shared )
38
- target_link_libraries (CufRuntime .shared PUBLIC
39
- flang_rt.shared
38
+ target_link_libraries (flang_rt.cuda .shared PUBLIC
39
+ flang_rt.runtime. shared
40
40
CUDA::cudart
41
41
)
42
42
endif ()
Original file line number Diff line number Diff line change @@ -14,5 +14,5 @@ add_flangrt_unittest(FlangCufRuntimeTests
14
14
15
15
target_link_libraries (FlangCufRuntimeTests
16
16
PRIVATE
17
- flang_rt.cuda
17
+ flang_rt.cuda.default
18
18
)
You can’t perform that action at this time.
0 commit comments