[cmake-developers] Retrieving OS Version in CMake

Brad King brad.king at kitware.com
Tue Jun 5 10:54:06 EDT 2018


On 06/04/2018 01:41 PM, Harry Mallon wrote:
> Would there be a use case for a Module that could retrieve
> OS name and version

We do have these variables:

  https://cmake.org/cmake/help/v3.11/variable/CMAKE_HOST_SYSTEM_NAME.html
  https://cmake.org/cmake/help/v3.11/variable/CMAKE_HOST_SYSTEM_VERSION.html

and this command:

  https://cmake.org/cmake/help/v3.11/command/cmake_host_system_information.html

but...

> (e.g. on macOS parse “sw_vers” to get “Mac OS X” and “10.13.4”, on Linux
> parse /etc/os-release to get “Fedora” and “28”)?

...they don't go down to this level of detail.  Perhaps the

  cmake_host_system_information

command could be taught additional queries for that.

-Brad


More information about the cmake-developers mailing list