Skip to content

Commit 5cb3285

Browse files
committed
Protect the dependent
The install target is sometimes the `None` target, which doesn't actually exist. This should perhaps be spelled `never_install` instead, but given that these are random names, we should protect the `add_dependencies` calls to only accept install components that actually exist.
1 parent aa89306 commit 5cb3285

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,9 @@ function(add_swift_target_library_single target name)
10431043
add_custom_target("${target}"
10441044
DEPENDS
10451045
"${swift_module_dependency_target}")
1046-
add_dependencies("${install_in_component}" "${target}")
1046+
if(TARGET "${install_in_component}")
1047+
add_dependencies("${install_in_component}" "${target}")
1048+
endif()
10471049

10481050
return()
10491051
endif()
@@ -1077,7 +1079,9 @@ function(add_swift_target_library_single target name)
10771079
if (SWIFTLIB_SINGLE_ONLY_SWIFTMODULE)
10781080
add_custom_target("${target}"
10791081
DEPENDS "${swift_module_dependency_target}")
1080-
add_dependencies("${install_in_component}" "${target}")
1082+
if(TARGET "${install_in_component}")
1083+
add_dependencies("${install_in_component}" "${target}")
1084+
endif()
10811085
return()
10821086
endif()
10831087

@@ -1086,7 +1090,7 @@ function(add_swift_target_library_single target name)
10861090
${SWIFTLIB_SINGLE_EXTERNAL_SOURCES}
10871091
${INCORPORATED_OBJECT_LIBRARIES_EXPRESSIONS}
10881092
${SWIFTLIB_SINGLE_XCODE_WORKAROUND_SOURCES})
1089-
if (NOT SWIFTLIB_SINGLE_OBJECT_LIBRARY)
1093+
if (NOT SWIFTLIB_SINGLE_OBJECT_LIBRARY AND TARGET "${install_in_component}")
10901094
add_dependencies("${install_in_component}" "${target}")
10911095
endif()
10921096
# NOTE: always inject the LLVMSupport directory before anything else. We want

0 commit comments

Comments
 (0)