Skip to content

Commit c119bfa

Browse files
committed
[Build] Relax CMAKE_C_COMPILER_ID "Clang" check to match AppleClang
In #19973 the logic that adds "-target" when building the C parts of the Standard Library and overlays was changed to use CMAKE_C_COMPILER_ID to only do so when the compiler ID is "Clang". However, on Apple toolchains the compiler ID is "AppleClang", so the target was no longer being explicitly set. Update the logic to relax the explicit check for "Clang" to also allow "AppleClang". rdar://problem/45579667
1 parent 5018a4b commit c119bfa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ function(_add_variant_c_compile_link_flags)
120120
endif()
121121

122122
# MSVC, clang-cl, gcc don't understand -target.
123-
if(CMAKE_C_COMPILER_ID STREQUAL Clang AND NOT SWIFT_COMPILER_IS_MSVC_LIKE)
123+
if(CMAKE_C_COMPILER_ID MATCHES "^Clang|AppleClang$" AND
124+
NOT SWIFT_COMPILER_IS_MSVC_LIKE)
124125
list(APPEND result "-target" "${SWIFT_SDK_${CFLAGS_SDK}_ARCH_${CFLAGS_ARCH}_TRIPLE}${DEPLOYMENT_VERSION}")
125126
endif()
126127

0 commit comments

Comments
 (0)