CMAKE_SYSTEM variable incorrect in Jenkins Docker container

I’m running a build pipeline within a redhat 8 docker container on jenkins. Part of the cmake build is doing OS checks. When running natively, on a RHEL 8 system, I get the expected current kernel version and el8_x version number.

Within the jenkins EL8 docker container in Jenkins, I’m getting a RHEL 9 kernel version which leads to determination of the OS to be el9.x. What’s going on here? the CMAKE version variables are the correct RHEL 8 version, as well. And LSB returns the correct el8 version as well.

– CMAKE_MAJOR_VERSION: 3
– CMAKE_MINOR_VERSION: 26
– CMAKE_PATCH_VERSION: 5
– CMAKE_SYSTEM_INFO_FILE: Platform/Linux
– CMAKE_SYSTEM_NAME: Linux
– CMAKE_SYSTEM_PROCESSOR: x86_64
– CMAKE_SYSTEM_VERSION: 5.14.0-362.24.1.el9_3.x86_64
– CMAKE_HOST_SYSTEM_VERSION: 5.14.0-362.24.1.el9_3.x86_64
– CMAKE_SYSTEM: Linux-5.14.0-362.24.1.el9_3.x86_64
– LSB_RELEASE_ID_SHORT: RedHatEnterprise
– LSB_RELEASE_VERSION_SHORT: 8.9

Docker container use the host OS kernel.
I suppose CMake discovers the OS version using uname -r or something like that.

See also:

ah yes. Completely forgot about that. Thanks for the info! Will re-tool to use the output of os-release and/or lsb_release.