File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -139,9 +139,18 @@ if(NOT SWIFT_LIBRARY_PATH)
139
139
set (SWIFT_LIBRARY_PATH "${tmp_dir} /lib/swift" )
140
140
endif ()
141
141
142
- runcmd (COMMAND "xcrun" "-toolchain" "${SWIFT_DARWIN_XCRUN_TOOLCHAIN} " "-f" "clang"
143
- VARIABLE CLANG_EXEC
144
- ERROR "Unable to find Clang driver" )
142
+ # If the CMAKE_C_COMPILER is already clang, don't find it again,
143
+ # thus allowing the --host-cc build-script argument to work here.
144
+ get_filename_component (c_compiler ${CMAKE_C_COMPILER} NAME )
145
+
146
+ if (${c_compiler} STREQUAL "clang" )
147
+ set (CLANG_EXEC ${CMAKE_C_COMPILER} )
148
+ else ()
149
+ runcmd (COMMAND "xcrun" "-toolchain" "${SWIFT_DARWIN_XCRUN_TOOLCHAIN} " "-f" "clang"
150
+ VARIABLE CLANG_EXEC
151
+ ERROR "Unable to find Clang driver" )
152
+ endif ()
153
+
145
154
146
155
# You have to delete CMakeCache.txt in the swift build to force a
147
156
# reconfiguration.
You can’t perform that action at this time.
0 commit comments