summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2022-08-15 17:53:35 (GMT)
committerCraig Scott <craig.scott@crascit.com>2022-08-20 23:27:59 (GMT)
commita20d7a9707009a5195a817ac54ecabbfd8bd48db (patch)
tree33d2002c812ddd3ca694c93a6557a3147462ff81
parent2ae42d0aa38ead2935d545f7d398ddf5df8b396d (diff)
downloadCMake-a20d7a9707009a5195a817ac54ecabbfd8bd48db.zip
CMake-a20d7a9707009a5195a817ac54ecabbfd8bd48db.tar.gz
CMake-a20d7a9707009a5195a817ac54ecabbfd8bd48db.tar.bz2
BSD: Set *BSD variables when targeting a *BSD system
Fixes: #23853
-rw-r--r--Help/manual/cmake-variables.7.rst5
-rw-r--r--Help/release/dev/bsd-variables.rst9
-rw-r--r--Help/variable/BSD.rst6
-rw-r--r--Help/variable/DRAGONFLYBSD.rst6
-rw-r--r--Help/variable/FREEBSD.rst6
-rw-r--r--Help/variable/NETBSD.rst6
-rw-r--r--Help/variable/OPENBSD.rst6
-rw-r--r--Modules/Platform/DragonFly.cmake2
-rw-r--r--Modules/Platform/FreeBSD.cmake2
-rw-r--r--Modules/Platform/NetBSD.cmake2
-rw-r--r--Modules/Platform/OpenBSD.cmake2
11 files changed, 52 insertions, 0 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 9fc8a79..1380a179 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -301,6 +301,7 @@ Variables that Describe the System
/variable/ANDROID
/variable/APPLE
/variable/BORLAND
+ /variable/BSD
/variable/CMAKE_ANDROID_NDK_VERSION
/variable/CMAKE_CL_64
/variable/CMAKE_COMPILER_2005
@@ -320,6 +321,8 @@ Variables that Describe the System
/variable/CMAKE_SYSTEM_PROCESSOR
/variable/CMAKE_SYSTEM_VERSION
/variable/CYGWIN
+ /variable/DRAGONFLYBSD
+ /variable/FREEBSD
/variable/GHSMULTI
/variable/IOS
/variable/LINUX
@@ -338,6 +341,8 @@ Variables that Describe the System
/variable/MSVC_TOOLSET_VERSION
/variable/MSVC_VERSION
/variable/MSYS
+ /variable/NETBSD
+ /variable/OPENBSD
/variable/UNIX
/variable/WIN32
/variable/WINCE
diff --git a/Help/release/dev/bsd-variables.rst b/Help/release/dev/bsd-variables.rst
new file mode 100644
index 0000000..9d59edc
--- /dev/null
+++ b/Help/release/dev/bsd-variables.rst
@@ -0,0 +1,9 @@
+bsd-variables
+-------------
+
+* The :variable:`BSD` variable is set to true when the target system
+ is BSD (DragonFlyBSD, FreeBSD, OpenBSD, or NetBSD)
+* The :variable:`DRAGONFLYBSD` variable is set to true when the target system is DragonFlyBSD.
+* The :variable:`FREEBSD` variable is set to true when the target system is FreeBSD.
+* The :variable:`NETBSD` variable is set to true when the target system is NetBSD.
+* The :variable:`OPENBSD` variable is set to true when the target system is OpenBSD.
diff --git a/Help/variable/BSD.rst b/Help/variable/BSD.rst
new file mode 100644
index 0000000..0b3e5dc
--- /dev/null
+++ b/Help/variable/BSD.rst
@@ -0,0 +1,6 @@
+BSD
+---
+
+.. versionadded:: 3.25
+
+Set to true when the target system is BSD (DragonFlyBSD, FreeBSD, OpenBSD, or NetBSD)
diff --git a/Help/variable/DRAGONFLYBSD.rst b/Help/variable/DRAGONFLYBSD.rst
new file mode 100644
index 0000000..f006156
--- /dev/null
+++ b/Help/variable/DRAGONFLYBSD.rst
@@ -0,0 +1,6 @@
+DRAGONFLYBSD
+------------
+
+.. versionadded:: 3.25
+
+Set to true when the target system is DragonFlyBSD.
diff --git a/Help/variable/FREEBSD.rst b/Help/variable/FREEBSD.rst
new file mode 100644
index 0000000..9990948
--- /dev/null
+++ b/Help/variable/FREEBSD.rst
@@ -0,0 +1,6 @@
+FREEBSD
+-------
+
+.. versionadded:: 3.25
+
+Set to true when the target system is FreeBSD.
diff --git a/Help/variable/NETBSD.rst b/Help/variable/NETBSD.rst
new file mode 100644
index 0000000..e7965f8
--- /dev/null
+++ b/Help/variable/NETBSD.rst
@@ -0,0 +1,6 @@
+NETBSD
+------
+
+.. versionadded:: 3.25
+
+Set to true when the target system is NetBSD.
diff --git a/Help/variable/OPENBSD.rst b/Help/variable/OPENBSD.rst
new file mode 100644
index 0000000..dd9b23d
--- /dev/null
+++ b/Help/variable/OPENBSD.rst
@@ -0,0 +1,6 @@
+OPENBSD
+-------
+
+.. versionadded:: 3.25
+
+Set to true when the target system is OpenBSD.
diff --git a/Modules/Platform/DragonFly.cmake b/Modules/Platform/DragonFly.cmake
index 12e5f3c..d8bc05a 100644
--- a/Modules/Platform/DragonFly.cmake
+++ b/Modules/Platform/DragonFly.cmake
@@ -3,6 +3,8 @@
# see http://archive.netbsd.se/?ml=dfbsd-users&a=2007-07&m=4678361
include(Platform/FreeBSD)
+unset(FREEBSD)
+set(DRAGONFLYBSD 1)
# DragonFly BSD requires -z origin to enable $ORIGIN expansion in RPATH.
# This is not required for FreeBSD since 10.2-RELEASE.
diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake
index bd5a786..e968a78 100644
--- a/Modules/Platform/FreeBSD.cmake
+++ b/Modules/Platform/FreeBSD.cmake
@@ -1,3 +1,5 @@
+set(FREEBSD 1)
+set(BSD 1)
set(CMAKE_DL_LIBS "")
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake
index ab85923..a64bf0b 100644
--- a/Modules/Platform/NetBSD.cmake
+++ b/Modules/Platform/NetBSD.cmake
@@ -1,3 +1,5 @@
+set(NETBSD 1)
+set(BSD 1)
set(CMAKE_DL_LIBS "")
set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
diff --git a/Modules/Platform/OpenBSD.cmake b/Modules/Platform/OpenBSD.cmake
index 97e2a6a..f6b955a 100644
--- a/Modules/Platform/OpenBSD.cmake
+++ b/Modules/Platform/OpenBSD.cmake
@@ -1,4 +1,6 @@
include(Platform/NetBSD)
+unset(NETBSD)
+set(OPENBSD 1)
# On OpenBSD, the compile time linker does not share it's configuration with
# the runtime linker. This will extract the library search paths from the