summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@qt.io>2022-08-10 13:54:05 (GMT)
committerCraig Scott <craig.scott@crascit.com>2022-08-11 21:20:05 (GMT)
commit62cd3904bf22fd75a2502af09ef67f8458ce06e1 (patch)
tree1b5a145132ae73b4f0809ec0c6b6c4c51c7bfa03
parent1493ed10a1485053bb0b7101ccd71d0101977402 (diff)
downloadCMake-62cd3904bf22fd75a2502af09ef67f8458ce06e1.zip
CMake-62cd3904bf22fd75a2502af09ef67f8458ce06e1.tar.gz
CMake-62cd3904bf22fd75a2502af09ef67f8458ce06e1.tar.bz2
variable: Set LINUX variable on Linux target systems
Fixes: #23840
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/release/dev/LINUX.rst4
-rw-r--r--Help/variable/LINUX.rst6
-rw-r--r--Modules/Platform/Linux.cmake1
-rw-r--r--Modules/Platform/kFreeBSD.cmake1
5 files changed, 13 insertions, 0 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index ce65aee..9fc8a79 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -322,6 +322,7 @@ Variables that Describe the System
/variable/CYGWIN
/variable/GHSMULTI
/variable/IOS
+ /variable/LINUX
/variable/MINGW
/variable/MSVC
/variable/MSVC10
diff --git a/Help/release/dev/LINUX.rst b/Help/release/dev/LINUX.rst
new file mode 100644
index 0000000..45b7029
--- /dev/null
+++ b/Help/release/dev/LINUX.rst
@@ -0,0 +1,4 @@
+Variables
+---------
+
+* The :variable:`LINUX` variable is set to true when the target system is Linux.
diff --git a/Help/variable/LINUX.rst b/Help/variable/LINUX.rst
new file mode 100644
index 0000000..26379b3
--- /dev/null
+++ b/Help/variable/LINUX.rst
@@ -0,0 +1,6 @@
+LINUX
+-----
+
+.. versionadded:: 3.25
+
+Set to true when the target system is Linux.
diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
index a7e58ab..e3d444e 100644
--- a/Modules/Platform/Linux.cmake
+++ b/Modules/Platform/Linux.cmake
@@ -1,3 +1,4 @@
+set(LINUX 1)
set(CMAKE_DL_LIBS "dl")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
diff --git a/Modules/Platform/kFreeBSD.cmake b/Modules/Platform/kFreeBSD.cmake
index c1db259..01ddfd3 100644
--- a/Modules/Platform/kFreeBSD.cmake
+++ b/Modules/Platform/kFreeBSD.cmake
@@ -1,4 +1,5 @@
# kFreeBSD looks just like Linux.
include(Platform/Linux)
+unset(LINUX)
set(CMAKE_LIBRARY_ARCHITECTURE_REGEX "[a-z0-9_]+(-[a-z0-9_]+)?-kfreebsd-gnu[a-z0-9_]*")