about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-08-15 03:08:03 +0000
committerbors <bors@rust-lang.org>2020-08-15 03:08:03 +0000
commit45060c2a66dfd667f88bd8b94261b28a58d85bd5 (patch)
treeaa173050fa295a736d6ab1e5a1a23529262e1b9b /src/bootstrap
parent668a34e0f438d4a950b9440239656d6755ad963c (diff)
parent29a946203aeebdd0d8466968705694fea9ca866f (diff)
Auto merge of #75549 - tmandry:rollup-sxjwa0w, r=tmandry
Rollup of 4 pull requests

Successful merges:

 - #75376 (Set CMAKE_SYSTEM_NAME when cross-compiling)
 - #75448 (merge `as_local_hir_id` with `local_def_id_to_hir_id`)
 - #75513 (Recover gracefully from `struct` parse errors)
 - #75545 (std/sys/unix/time: make it easier for LLVM to optimize `Instant` subtraction.)

Failed merges:

 - #75514 (Replaced `log` with `tracing`)

r? @ghost
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/native.rs24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index 3ab50e114c7..7d9b442e646 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -282,14 +282,6 @@ impl Step for Llvm {
                 "LLVM_CONFIG_PATH",
                 host_bin.join("llvm-config").with_extension(EXE_EXTENSION),
             );
-
-            if target.contains("netbsd") {
-                cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
-            } else if target.contains("freebsd") {
-                cfg.define("CMAKE_SYSTEM_NAME", "FreeBSD");
-            } else if target.contains("windows") {
-                cfg.define("CMAKE_SYSTEM_NAME", "Windows");
-            }
         }
 
         if let Some(ref suffix) = builder.config.llvm_version_suffix {
@@ -378,6 +370,22 @@ fn configure_cmake(
     }
     cfg.target(&target.triple).host(&builder.config.build.triple);
 
+    if target != builder.config.build {
+        if target.contains("netbsd") {
+            cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
+        } else if target.contains("freebsd") {
+            cfg.define("CMAKE_SYSTEM_NAME", "FreeBSD");
+        } else if target.contains("windows") {
+            cfg.define("CMAKE_SYSTEM_NAME", "Windows");
+        }
+        // When cross-compiling we should also set CMAKE_SYSTEM_VERSION, but in
+        // that case like CMake we cannot easily determine system version either.
+        //
+        // Since, the LLVM itself makes rather limited use of version checks in
+        // CMakeFiles (and then only in tests), and so far no issues have been
+        // reported, the system version is currently left unset.
+    }
+
     let sanitize_cc = |cc: &Path| {
         if target.contains("msvc") {
             OsString::from(cc.to_str().unwrap().replace("\\", "/"))