diff options
author | Brad King <brad.king@kitware.com> | 2022-09-13 13:45:36 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-09-13 13:46:01 (GMT) |
commit | 358a49ef9b37a5bf9e64b2ced08cab2b45509b66 (patch) | |
tree | f3b9d37880d342b3c8790fb09a8dc01aafe93d2e | |
parent | fd3036268132a0a31e7b445f718da5c68e20ece3 (diff) | |
parent | caffb15d096116f45597c9c51c23041ff9b39de3 (diff) | |
download | CMake-358a49ef9b37a5bf9e64b2ced08cab2b45509b66.zip CMake-358a49ef9b37a5bf9e64b2ced08cab2b45509b66.tar.gz CMake-358a49ef9b37a5bf9e64b2ced08cab2b45509b66.tar.bz2 |
Merge topic 'LINUX-host'
caffb15d09 LINUX: Set CMAKE_HOST_LINUX variable when running on a Linux host
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: hinell <al.neodim@gmail.com>
Merge-request: !7661
-rw-r--r-- | Help/manual/cmake-variables.7.rst | 1 | ||||
-rw-r--r-- | Help/release/dev/LINUX.rst | 2 | ||||
-rw-r--r-- | Help/variable/CMAKE_HOST_LINUX.rst | 6 | ||||
-rw-r--r-- | Modules/CMakeSystemSpecificInformation.cmake | 1 | ||||
-rw-r--r-- | Source/cmStateSnapshot.cxx | 5 |
5 files changed, 15 insertions, 0 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 22fae08..6533ca5 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -310,6 +310,7 @@ Variables that Describe the System /variable/CMAKE_COMPILER_2005 /variable/CMAKE_HOST_APPLE /variable/CMAKE_HOST_BSD + /variable/CMAKE_HOST_LINUX /variable/CMAKE_HOST_SOLARIS /variable/CMAKE_HOST_SYSTEM /variable/CMAKE_HOST_SYSTEM_NAME diff --git a/Help/release/dev/LINUX.rst b/Help/release/dev/LINUX.rst index 45b7029..b837a1f 100644 --- a/Help/release/dev/LINUX.rst +++ b/Help/release/dev/LINUX.rst @@ -2,3 +2,5 @@ Variables --------- * The :variable:`LINUX` variable is set to true when the target system is Linux. + +* The :variable:`CMAKE_HOST_LINUX` variable is set to true when the host system is Linux. diff --git a/Help/variable/CMAKE_HOST_LINUX.rst b/Help/variable/CMAKE_HOST_LINUX.rst new file mode 100644 index 0000000..e2361bd --- /dev/null +++ b/Help/variable/CMAKE_HOST_LINUX.rst @@ -0,0 +1,6 @@ +CMAKE_HOST_LINUX +---------------- + +.. versionadded:: 3.25 + +Set to true when the host system is Linux. diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index 319b0bb..b5dc8d3 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -17,6 +17,7 @@ set(CYGWIN ) set(MSYS ) set(WIN32 ) set(BSD ) +set(LINUX ) function(_cmake_record_install_prefix ) set(_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_VALUE "${CMAKE_INSTALL_PREFIX}" PARENT_SCOPE) diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 102d1ce..c51650a 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -331,6 +331,11 @@ void cmStateSnapshot::SetDefaultDefinitions() this->SetDefinition("CMAKE_HOST_BSD", "DragonFlyBSD"); #endif +#if defined(__linux__) + this->SetDefinition("LINUX", "1"); + this->SetDefinition("CMAKE_HOST_LINUX", "1"); +#endif + this->SetDefinition("CMAKE_MAJOR_VERSION", std::to_string(cmVersion::GetMajorVersion())); this->SetDefinition("CMAKE_MINOR_VERSION", |