Skip to content

Commit b100181

Browse files
committed
Update CMakeList template for benchmarks
1 parent 61653d2 commit b100181

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

benchmark/scripts/generate_harness/CMakeLists.txt_template

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,18 @@ if(NOT SWIFT_LIBRARY_PATH)
6767
set(SWIFT_LIBRARY_PATH "${tmp_dir}/lib/swift")
6868
endif()
6969

70-
runcmd(COMMAND "xcrun" "-toolchain" "${SWIFT_DARWIN_XCRUN_TOOLCHAIN}" "-f" "clang"
71-
VARIABLE CLANG_EXEC
72-
ERROR "Unable to find Clang driver")
70+
# If the CMAKE_C_COMPILER is already clang, don't find it again,
71+
# thus allowing the --host-cc build-script argument to work here.
72+
get_filename_component(c_compiler ${CMAKE_C_COMPILER} NAME)
73+
74+
if(${c_compiler} STREQUAL "clang")
75+
set(CLANG_EXEC ${CMAKE_C_COMPILER})
76+
else()
77+
runcmd(COMMAND "xcrun" "-toolchain" "${SWIFT_DARWIN_XCRUN_TOOLCHAIN}" "-f" "clang"
78+
VARIABLE CLANG_EXEC
79+
ERROR "Unable to find Clang driver")
80+
endif()
81+
7382

7483
# You have to delete CMakeCache.txt in the swift build to force a
7584
# reconfiguration.

0 commit comments

Comments
 (0)