about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-05-03 06:04:12 +0000
committerbors <bors@rust-lang.org>2017-05-03 06:04:12 +0000
commit5d0865315b0f46546db298f7bcdaa713cf20e11a (patch)
treed8ce1ae7a2bda27d98c44cf41c7f9b49fbbe9ed0
parent146dc670cfec54a02bc1eddef62f6a595c6b3726 (diff)
parent1ed07ba4f12063c86ce25d3b27326d982211a64c (diff)
downloadrust-5d0865315b0f46546db298f7bcdaa713cf20e11a.tar.gz
rust-5d0865315b0f46546db298f7bcdaa713cf20e11a.zip
Auto merge of #41713 - cuviper:cmake-sanitizers, r=alexcrichton
rustbuild: Sanity-check cmake for sanitizers too

It's possible to build the sanitizers when using an external LLVM, but
we still need cmake for this.  Extend the sanity check to look for cmake
whenever sanitizers are enabled too.
-rw-r--r--src/bootstrap/sanity.rs27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs
index d1b235f4691..df6378a970b 100644
--- a/src/bootstrap/sanity.rs
+++ b/src/bootstrap/sanity.rs
@@ -69,22 +69,21 @@ pub fn check(build: &mut Build) {
         need_cmd("git".as_ref());
     }
 
-    // We need cmake, but only if we're actually building LLVM
-    for host in build.config.host.iter() {
-        if let Some(config) = build.config.target_config.get(host) {
-            if config.llvm_config.is_some() {
-                continue
-            }
-        }
+    // We need cmake, but only if we're actually building LLVM or sanitizers.
+    let building_llvm = build.config.host.iter()
+        .filter_map(|host| build.config.target_config.get(host))
+        .any(|config| config.llvm_config.is_none());
+    if building_llvm || build.config.sanitizers {
         need_cmd("cmake".as_ref());
-        if build.config.ninja {
-            // Some Linux distros rename `ninja` to `ninja-build`.
-            // CMake can work with either binary name.
-            if have_cmd("ninja-build".as_ref()).is_none() {
-                need_cmd("ninja".as_ref());
-            }
+    }
+
+    // Ninja is currently only used for LLVM itself.
+    if building_llvm && build.config.ninja {
+        // Some Linux distros rename `ninja` to `ninja-build`.
+        // CMake can work with either binary name.
+        if have_cmd("ninja-build".as_ref()).is_none() {
+            need_cmd("ninja".as_ref());
         }
-        break
     }
 
     if build.config.python.is_none() {