Skip to content

Commit

Permalink
Rollup merge of rust-lang#57368 - petrhosek:cmake-compiler-launcher, …
Browse files Browse the repository at this point in the history
…r=alexcrichton

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.
  • Loading branch information
Centril authored Jan 12, 2019
2 parents ebbecac + 42e65c1 commit c6146b2
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,13 @@ fn configure_cmake(builder: &Builder,
if builder.config.llvm_clang_cl.is_some() && target.contains("i686") {
cfg.env("SCCACHE_EXTRA_ARGS", "-m32");
}

// If ccache is configured we inform the build a little differently how
// to invoke ccache while also invoking our compilers.
} else if let Some(ref ccache) = builder.config.ccache {
cfg.define("CMAKE_C_COMPILER", ccache)
.define("CMAKE_C_COMPILER_ARG1", sanitize_cc(cc))
.define("CMAKE_CXX_COMPILER", ccache)
.define("CMAKE_CXX_COMPILER_ARG1", sanitize_cc(cxx));
} else {
// If ccache is configured we inform the build a little differently how
// to invoke ccache while also invoking our compilers.
if let Some(ref ccache) = builder.config.ccache {
cfg.define("CMAKE_C_COMPILER_LAUNCHER", ccache)
.define("CMAKE_CXX_COMPILER_LAUNCHER", ccache);
}
cfg.define("CMAKE_C_COMPILER", sanitize_cc(cc))
.define("CMAKE_CXX_COMPILER", sanitize_cc(cxx));
}
Expand Down

0 comments on commit c6146b2

Please sign in to comment.