summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2021-07-30 00:49:04 (GMT)
committerBrad King <brad.king@kitware.com>2021-08-20 13:35:09 (GMT)
commit1e65e4a6e5c4870960b998b6f5d6f70965cc9344 (patch)
tree8d685a4b1a523c2765c6b729099bc533234c7a08 /Help
parente808cbb1dd9bf594e2f2c8ea2c0b82b9a6590d29 (diff)
downloadCMake-1e65e4a6e5c4870960b998b6f5d6f70965cc9344.zip
CMake-1e65e4a6e5c4870960b998b6f5d6f70965cc9344.tar.gz
CMake-1e65e4a6e5c4870960b998b6f5d6f70965cc9344.tar.bz2
cmake_host_system_information: Can read `/etc/os-release` file
Diffstat (limited to 'Help')
-rw-r--r--Help/command/cmake_host_system_information.rst45
-rw-r--r--Help/release/dev/os-release.rst6
2 files changed, 51 insertions, 0 deletions
diff --git a/Help/command/cmake_host_system_information.rst b/Help/command/cmake_host_system_information.rst
index ac6a008..ae24b03 100644
--- a/Help/command/cmake_host_system_information.rst
+++ b/Help/command/cmake_host_system_information.rst
@@ -132,7 +132,52 @@ 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
+
+ Read :file:`/etc/os-release` file and define the given ``<variable>``
+ into a list of read variables
+
+``DISTRIB_<name>``
+ .. versionadded:: 3.22
+
+ Get the ``<name>`` variable if it exists in the :file:`/etc/os-release` file
+
+ Example:
+
+ .. code-block:: cmake
+
+ cmake_host_system_information(RESULT PRETTY_NAME QUERY DISTRIB_PRETTY_NAME)
+ message(STATUS "${PRETTY_NAME}")
+
+ cmake_host_system_information(RESULT DISTRO QUERY DISTRIB_INFO)
+
+ foreach(VAR IN LISTS DISTRO)
+ message(STATUS "${VAR}=`${${VAR}}`")
+ endforeach()
+
+
+ Output::
+
+ -- Ubuntu 20.04.2 LTS
+ -- DISTRO_BUG_REPORT_URL=`https://bugs.launchpad.net/ubuntu/`
+ -- DISTRO_HOME_URL=`https://www.ubuntu.com/`
+ -- DISTRO_ID=`ubuntu`
+ -- DISTRO_ID_LIKE=`debian`
+ -- DISTRO_NAME=`Ubuntu`
+ -- DISTRO_PRETTY_NAME=`Ubuntu 20.04.2 LTS`
+ -- DISTRO_PRIVACY_POLICY_URL=`https://www.ubuntu.com/legal/terms-and-policies/privacy-policy`
+ -- DISTRO_SUPPORT_URL=`https://help.ubuntu.com/`
+ -- DISTRO_UBUNTU_CODENAME=`focal`
+ -- DISTRO_VERSION=`20.04.2 LTS (Focal Fossa)`
+ -- DISTRO_VERSION_CODENAME=`focal`
+ -- DISTRO_VERSION_ID=`20.04`
.. rubric:: Footnotes
.. [#mebibytes] One MiB (mebibyte) is equal to 1024x1024 bytes.
+
+.. _man 5 os-release: https://www.freedesktop.org/software/systemd/man/os-release.html
diff --git a/Help/release/dev/os-release.rst b/Help/release/dev/os-release.rst
new file mode 100644
index 0000000..cce6aee
--- /dev/null
+++ b/Help/release/dev/os-release.rst
@@ -0,0 +1,6 @@
+os-release
+----------
+
+* The :command:`cmake_host_system_information` command query operating system
+ identification `variables <https://www.freedesktop.org/software/systemd/man/os-release.html>`_
+ from the :file:`/etc/os-release` file.