Skip to content

Commit 5d08653

Browse files
committed
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.
2 parents 146dc67 + 1ed07ba commit 5d08653

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/bootstrap/sanity.rs

+13-14
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,21 @@ pub fn check(build: &mut Build) {
6969
need_cmd("git".as_ref());
7070
}
7171

72-
// We need cmake, but only if we're actually building LLVM
73-
for host in build.config.host.iter() {
74-
if let Some(config) = build.config.target_config.get(host) {
75-
if config.llvm_config.is_some() {
76-
continue
77-
}
78-
}
72+
// We need cmake, but only if we're actually building LLVM or sanitizers.
73+
let building_llvm = build.config.host.iter()
74+
.filter_map(|host| build.config.target_config.get(host))
75+
.any(|config| config.llvm_config.is_none());
76+
if building_llvm || build.config.sanitizers {
7977
need_cmd("cmake".as_ref());
80-
if build.config.ninja {
81-
// Some Linux distros rename `ninja` to `ninja-build`.
82-
// CMake can work with either binary name.
83-
if have_cmd("ninja-build".as_ref()).is_none() {
84-
need_cmd("ninja".as_ref());
85-
}
78+
}
79+
80+
// Ninja is currently only used for LLVM itself.
81+
if building_llvm && build.config.ninja {
82+
// Some Linux distros rename `ninja` to `ninja-build`.
83+
// CMake can work with either binary name.
84+
if have_cmd("ninja-build".as_ref()).is_none() {
85+
need_cmd("ninja".as_ref());
8686
}
87-
break
8887
}
8988

9089
if build.config.python.is_none() {

0 commit comments

Comments
 (0)