diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2020-08-14 20:07:10 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-14 20:07:10 -0700 |
| commit | 29b6b5feaa86969dc97b42f72fe5837b0d8b523e (patch) | |
| tree | 039d227847a6bf3e1cd00a88490b0297b6865619 | |
| parent | 668a34e0f438d4a950b9440239656d6755ad963c (diff) | |
| parent | 91f87bc9bc29461513aaa6252905a7ac0ac303e9 (diff) | |
| download | rust-29b6b5feaa86969dc97b42f72fe5837b0d8b523e.tar.gz rust-29b6b5feaa86969dc97b42f72fe5837b0d8b523e.zip | |
Rollup merge of #75376 - tmiasko:cmake-system-name, r=Mark-Simulacrum
Set CMAKE_SYSTEM_NAME when cross-compiling Configure CMAKE_SYSTEM_NAME when cross-compiling in `configure_cmake`, to tell CMake about target system. Previously this was done only for LLVM step and now applies more generally to steps using cmake. Helps with #74576.
| -rw-r--r-- | src/bootstrap/native.rs | 24 |
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("\\", "/")) |
