Skip to content

Commit 42e65c1

Browse files
committed
Use CMAKE_{C,CXX}_COMPILER_LAUNCHER for ccache
CMake 3.4 and newer which is the required minimum version for LLVM supports CMAKE_{C,CXX}_COMPILER_LAUNCHER for settting the compiler launcher such as ccache which doesn't require shifting arguments.
1 parent 36500de commit 42e65c1

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/bootstrap/native.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -347,15 +347,13 @@ fn configure_cmake(builder: &Builder,
347347
if builder.config.llvm_clang_cl.is_some() && target.contains("i686") {
348348
cfg.env("SCCACHE_EXTRA_ARGS", "-m32");
349349
}
350-
351-
// If ccache is configured we inform the build a little differently how
352-
// to invoke ccache while also invoking our compilers.
353-
} else if let Some(ref ccache) = builder.config.ccache {
354-
cfg.define("CMAKE_C_COMPILER", ccache)
355-
.define("CMAKE_C_COMPILER_ARG1", sanitize_cc(cc))
356-
.define("CMAKE_CXX_COMPILER", ccache)
357-
.define("CMAKE_CXX_COMPILER_ARG1", sanitize_cc(cxx));
358350
} else {
351+
// If ccache is configured we inform the build a little differently how
352+
// to invoke ccache while also invoking our compilers.
353+
if let Some(ref ccache) = builder.config.ccache {
354+
cfg.define("CMAKE_C_COMPILER_LAUNCHER", ccache)
355+
.define("CMAKE_CXX_COMPILER_LAUNCHER", ccache);
356+
}
359357
cfg.define("CMAKE_C_COMPILER", sanitize_cc(cc))
360358
.define("CMAKE_CXX_COMPILER", sanitize_cc(cxx));
361359
}

0 commit comments

Comments
 (0)