Skip to content

Commit a0538db

Browse files
author
Alex Zepeda
committed
bootstrap: Define CMake platform if DragonFly.
CMAKE_SYSTEM_NAME is defined on a cross build if the target is recognized. Without this explicit definition cmake will assume that we're building for the host platform which can bring in unwanted compiler and linker flags. Also, add a warning on cross builds with unknown target to aid in cross builds for future platforms.
1 parent 0308df2 commit a0538db

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/bootstrap/download-ci-llvm-stamp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Change this file to make users of the `download-ci-llvm` configuration download
22
a new version of LLVM from CI, even if the LLVM submodule hasn’t changed.
33

4-
Last change is for: https://github.com/rust-lang/rust/pull/112931
4+
Last change is for: https://github.com/rust-lang/rust/pull/113996

src/bootstrap/llvm.rs

+7
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@ fn configure_cmake(
559559

560560
if target.contains("netbsd") {
561561
cfg.define("CMAKE_SYSTEM_NAME", "NetBSD");
562+
} else if target.contains("dragonfly") {
563+
cfg.define("CMAKE_SYSTEM_NAME", "DragonFly");
562564
} else if target.contains("freebsd") {
563565
cfg.define("CMAKE_SYSTEM_NAME", "FreeBSD");
564566
} else if target.contains("windows") {
@@ -569,7 +571,12 @@ fn configure_cmake(
569571
cfg.define("CMAKE_SYSTEM_NAME", "SunOS");
570572
} else if target.contains("linux") {
571573
cfg.define("CMAKE_SYSTEM_NAME", "Linux");
574+
} else {
575+
builder.info(
576+
"could not determine CMAKE_SYSTEM_NAME from the target `{target}`, build may fail",
577+
);
572578
}
579+
573580
// When cross-compiling we should also set CMAKE_SYSTEM_VERSION, but in
574581
// that case like CMake we cannot easily determine system version either.
575582
//

0 commit comments

Comments
 (0)