]> git.lizzy.rs Git - rust.git/commitdiff
Use CMAKE_{C,CXX}_COMPILER_LAUNCHER for ccache
authorPetr Hosek <phosek@google.com>
Sun, 6 Jan 2019 03:11:27 +0000 (19:11 -0800)
committerPetr Hosek <phosek@google.com>
Sun, 6 Jan 2019 03:11:27 +0000 (19:11 -0800)
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.

src/bootstrap/native.rs

index c548d7f6948dc17ab6bf53195cd643a83feced5f..83212b131c8ebe7e32e7f48208b77fe60aa7be58 100644 (file)
@@ -347,15 +347,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));
     }