summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2021-08-03 17:24:59 (GMT)
committerBrad King <brad.king@kitware.com>2021-08-20 13:35:12 (GMT)
commitb9698f89df275a33b01cfc7b4f88a510ad9d8bbe (patch)
tree6609ec5fea7d0bf37125bb1ad1e8b86a05cea0bd
parent5469c71a824880eb646a0003cb001c58f24f9cce (diff)
downloadCMake-b9698f89df275a33b01cfc7b4f88a510ad9d8bbe.zip
CMake-b9698f89df275a33b01cfc7b4f88a510ad9d8bbe.tar.gz
CMake-b9698f89df275a33b01cfc7b4f88a510ad9d8bbe.tar.bz2
cmake_host_system_information: Make it available for all systems
Before it was Linux only.
-rw-r--r--Help/command/cmake_host_system_information.rst6
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx4
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake16
4 files changed, 9 insertions, 19 deletions
diff --git a/Help/command/cmake_host_system_information.rst b/Help/command/cmake_host_system_information.rst
index 66249ad..998e146 100644
--- a/Help/command/cmake_host_system_information.rst
+++ b/Help/command/cmake_host_system_information.rst
@@ -132,9 +132,6 @@ queried. The list of queried values is stored in ``<variable>``.
See :variable:`CMAKE_HOST_SYSTEM_PROCESSOR`
-For Linux distributions additional ``<key>`` values are available to get operating
-system identification as described in the `man 5 os-release`_.
-
``DISTRIB_INFO``
.. versionadded:: 3.22
@@ -144,7 +141,8 @@ system identification as described in the `man 5 os-release`_.
``DISTRIB_<name>``
.. versionadded:: 3.22
- Get the ``<name>`` variable if it exists in the :file:`/etc/os-release` file
+ Get the ``<name>`` variable (see `man 5 os-release`_) if it exists in the
+ :file:`/etc/os-release` file
Example:
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index b2c4534..74071ff 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -149,7 +149,6 @@ cm::optional<std::string> GetValue(cmsys::SystemInformation& info,
return {};
}
-#ifdef __linux__
cm::optional<std::pair<std::string, std::string>> ParseOSReleaseLine(
std::string const& line)
{
@@ -407,7 +406,6 @@ cm::optional<std::string> GetValue(cmExecutionStatus& status,
// NOTE Empty string means requested variable not set
return std::string{};
}
-#endif
#ifdef HAVE_VS_SETUP_HELPER
cm::optional<std::string> GetValue(cmExecutionStatus& status,
@@ -494,9 +492,7 @@ bool cmCMakeHostSystemInformationCommand(std::vector<std::string> const& args,
auto value =
GetValueChained(
[&]() { return GetValue(info, key); }
-#ifdef __linux__
, [&]() { return GetValue(status, key, variable); }
-#endif
#ifdef HAVE_VS_SETUP_HELPER
, [&]() { return GetValue(status, key); }
#endif
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 543ad1d..eb2c2d9 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -349,7 +349,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
endif()
add_RunCMake_test(execute_process)
add_RunCMake_test(export)
-add_RunCMake_test(cmake_host_system_information -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
+add_RunCMake_test(cmake_host_system_information)
add_RunCMake_test(cmake_language)
add_RunCMake_test(cmake_minimum_required)
add_RunCMake_test(cmake_parse_arguments)
diff --git a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
index 7462f7a..189013f 100644
--- a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
+++ b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
@@ -7,15 +7,11 @@ run_cmake(BadArg3)
run_cmake(QueryList)
run_cmake(QueryKeys)
-if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+run_cmake(UnitTest)
+run_cmake(Exherbo)
+run_cmake(Ubuntu)
- run_cmake_with_options(UnitTest)
- run_cmake_with_options(Exherbo)
- run_cmake_with_options(Ubuntu)
+run_cmake(CentOS6)
+run_cmake(Debian6)
- run_cmake_with_options(CentOS6)
- run_cmake_with_options(Debian6)
-
- run_cmake_with_options(UserFallbackScript)
-
-endif()
+run_cmake(UserFallbackScript)