summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2022-09-05 23:15:44 (GMT)
committerCristian Adam <cristian.adam@gmail.com>2022-09-05 23:15:44 (GMT)
commit1ea8b8ed86628ecaa6a6e47231cefb2d68ac9e73 (patch)
treef5ef2c28a216fa326cfe39335eb309b66b0d62c5 /Source
parent288f72efea0636c498755a9cec6d5ddcbfed5c8c (diff)
downloadCMake-1ea8b8ed86628ecaa6a6e47231cefb2d68ac9e73.zip
CMake-1ea8b8ed86628ecaa6a6e47231cefb2d68ac9e73.tar.gz
CMake-1ea8b8ed86628ecaa6a6e47231cefb2d68ac9e73.tar.bz2
BSD: Set CMAKE_HOST_BSD variable on a BSD host
Also the BSD variable will be set in CMake scripting mode (-P). Relates: #23853
Diffstat (limited to 'Source')
-rw-r--r--Source/cmStateSnapshot.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index f73df8f..102d1ce 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -317,6 +317,20 @@ void cmStateSnapshot::SetDefaultDefinitions()
this->SetDefinition("CMAKE_HOST_SOLARIS", "1");
#endif
+#if defined(__OpenBSD__)
+ this->SetDefinition("BSD", "OpenBSD");
+ this->SetDefinition("CMAKE_HOST_BSD", "OpenBSD");
+#elif defined(__FreeBSD__)
+ this->SetDefinition("BSD", "FreeBSD");
+ this->SetDefinition("CMAKE_HOST_BSD", "FreeBSD");
+#elif defined(__NetBSD__)
+ this->SetDefinition("BSD", "NetBSD");
+ this->SetDefinition("CMAKE_HOST_BSD", "NetBSD");
+#elif defined(__DragonFly__)
+ this->SetDefinition("BSD", "DragonFlyBSD");
+ this->SetDefinition("CMAKE_HOST_BSD", "DragonFlyBSD");
+#endif
+
this->SetDefinition("CMAKE_MAJOR_VERSION",
std::to_string(cmVersion::GetMajorVersion()));
this->SetDefinition("CMAKE_MINOR_VERSION",