Skip to content

Commit 1ab0008

Browse files
authored
Merge pull request #25523 from drodriguez/android-fix-test-build
[android] LINKER_LANGUAGE needs to be applied to executables too.
2 parents b70cd70 + 0a27c88 commit 1ab0008

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,6 +2346,17 @@ function(_add_swift_executable_single name)
23462346
target_link_libraries("${name}" PRIVATE ${SWIFTEXE_SINGLE_LINK_LIBRARIES})
23472347
swift_common_llvm_config("${name}" ${SWIFTEXE_SINGLE_LLVM_LINK_COMPONENTS})
23482348

2349+
# NOTE(compnerd) use the C linker language to invoke `clang` rather than
2350+
# `clang++` as we explicitly link against the C++ runtime. We were previously
2351+
# actually passing `-nostdlib++` to avoid the C++ runtime linkage.
2352+
if(SWIFTEXE_SINGLE_SDK STREQUAL ANDROID)
2353+
set_property(TARGET "${name}" PROPERTY
2354+
LINKER_LANGUAGE "C")
2355+
else()
2356+
set_property(TARGET "${name}" PROPERTY
2357+
LINKER_LANGUAGE "CXX")
2358+
endif()
2359+
23492360
set_target_properties(${name} PROPERTIES FOLDER "Swift executables")
23502361
endfunction()
23512362

0 commit comments

Comments
 (0)