Skip to content

Commit 15355ab

Browse files
committed
build: be more conservative when passing -target
When building the swift tools with gcc, we would fail as we would try to pass `-target` to gcc, which does not support this option. Invert the condition and only pass the argument when building with clang.
1 parent 23476e5 commit 15355ab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ function(_add_variant_c_compile_link_flags)
119119
endif()
120120
endif()
121121

122-
# MSVC and clang-cl don't understand -target.
123-
if (NOT SWIFT_COMPILER_IS_MSVC_LIKE)
122+
# MSVC, clang-cl, gcc don't understand -target.
123+
if(CMAKE_C_COMPILER_ID STREQUAL Clang AND NOT SWIFT_COMPILER_IS_MSVC_LIKE)
124124
list(APPEND result "-target" "${SWIFT_SDK_${CFLAGS_SDK}_ARCH_${CFLAGS_ARCH}_TRIPLE}${DEPLOYMENT_VERSION}")
125125
endif()
126126

0 commit comments

Comments
 (0)