@@ -677,10 +677,17 @@ fn configure_cmake(
677
677
if !builder. is_builder_target ( target) {
678
678
cfg. define ( "CMAKE_CROSSCOMPILING" , "True" ) ;
679
679
680
+ // NOTE: Ideally, we wouldn't have to do this, and `cmake-rs` would just handle it for us.
681
+ // But it currently determines this basd on the `CARGO_CFG_TARGET_OS` environment variable,
682
+ // which isn't set when compiling outside `build.rs` (like bootstrap is).
683
+ //
684
+ // So for now, we define `CMAKE_SYSTEM_NAME` ourselves, to panicking in `cmake-rs`.
680
685
if target. contains ( "netbsd" ) {
681
686
cfg. define ( "CMAKE_SYSTEM_NAME" , "NetBSD" ) ;
682
687
} else if target. contains ( "dragonfly" ) {
683
688
cfg. define ( "CMAKE_SYSTEM_NAME" , "DragonFly" ) ;
689
+ } else if target. contains ( "openbsd" ) {
690
+ cfg. define ( "CMAKE_SYSTEM_NAME" , "OpenBSD" ) ;
684
691
} else if target. contains ( "freebsd" ) {
685
692
cfg. define ( "CMAKE_SYSTEM_NAME" , "FreeBSD" ) ;
686
693
} else if target. is_windows ( ) {
@@ -691,10 +698,24 @@ fn configure_cmake(
691
698
cfg. define ( "CMAKE_SYSTEM_NAME" , "SunOS" ) ;
692
699
} else if target. contains ( "linux" ) {
693
700
cfg. define ( "CMAKE_SYSTEM_NAME" , "Linux" ) ;
701
+ } else if target. contains ( "darwin" ) {
702
+ cfg. define ( "CMAKE_SYSTEM_NAME" , "Darwin" ) ;
703
+ } else if target. contains ( "ios" ) {
704
+ cfg. define ( "CMAKE_SYSTEM_NAME" , "iOS" ) ;
705
+ } else if target. contains ( "tvos" ) {
706
+ cfg. define ( "CMAKE_SYSTEM_NAME" , "tvOS" ) ;
707
+ } else if target. contains ( "visionos" ) {
708
+ cfg. define ( "CMAKE_SYSTEM_NAME" , "visionOS" ) ;
709
+ } else if target. contains ( "watchos" ) {
710
+ cfg. define ( "CMAKE_SYSTEM_NAME" , "watchOS" ) ;
711
+ } else if target. contains ( "none" ) {
712
+ // Last branch
713
+ cfg. define ( "CMAKE_SYSTEM_NAME" , "Generic" ) ;
694
714
} else {
695
715
builder. info ( & format ! (
696
716
"could not determine CMAKE_SYSTEM_NAME from the target `{target}`, build may fail" ,
697
717
) ) ;
718
+ cfg. define ( "CMAKE_SYSTEM_NAME" , "Generic" ) ;
698
719
}
699
720
700
721
// When cross-compiling we should also set CMAKE_SYSTEM_VERSION, but in
0 commit comments