From 6c92f80f2ecb106916534d4b88704432476b9006 Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Thu, 29 Jul 2021 21:32:26 +0300 Subject: cmake_host_system_information: Also set `USED_FALLBACK_SCRIPT` If the OS identification was obtained via fallback script. --- Source/cmCMakeHostSystemInformationCommand.cxx | 5 ++++- Tests/RunCMake/cmake_host_system_information/CentOS6-stdout.txt | 1 + Tests/RunCMake/cmake_host_system_information/Debian6-stdout.txt | 1 + .../cmake_host_system_information/UserFallbackScript-stdout.txt | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index 90240a1..1464220 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -287,6 +287,8 @@ std::map GetOSReleaseVariables( // Ugh, it could be some pre-os-release distro. // Lets try some fallback getters. + // See also: + // - http://linuxmafia.com/faq/Admin/release-files.html // 1. CMake provided cmsys::Glob gl; @@ -358,8 +360,9 @@ std::map GetOSReleaseVariables( data.emplace(std::move(key), std::move(value)); } + // Try 'till some script can get anything if (!data.empty()) { - // Try 'till some script can get anything + data.emplace("USED_FALLBACK_SCRIPT", script); break; } } diff --git a/Tests/RunCMake/cmake_host_system_information/CentOS6-stdout.txt b/Tests/RunCMake/cmake_host_system_information/CentOS6-stdout.txt index 803ee08..50dbb08 100644 --- a/Tests/RunCMake/cmake_host_system_information/CentOS6-stdout.txt +++ b/Tests/RunCMake/cmake_host_system_information/CentOS6-stdout.txt @@ -2,5 +2,6 @@ -- CENTOS6_ID_LIKE=`rhel` -- CENTOS6_NAME=`CentOS` -- CENTOS6_PRETTY_NAME=`CentOS release 6\.10 \(Final\)` +-- CENTOS6_USED_FALLBACK_SCRIPT=`.*/Modules/Internal/OSRelease/010-TryOldCentOS.cmake` -- CENTOS6_VERSION=`6\.10` -- CENTOS6_VERSION_ID=`6\.10` diff --git a/Tests/RunCMake/cmake_host_system_information/Debian6-stdout.txt b/Tests/RunCMake/cmake_host_system_information/Debian6-stdout.txt index 60d6425..4193d6f 100644 --- a/Tests/RunCMake/cmake_host_system_information/Debian6-stdout.txt +++ b/Tests/RunCMake/cmake_host_system_information/Debian6-stdout.txt @@ -1,4 +1,5 @@ -- DEBIAN6_ID=`debian` -- DEBIAN6_NAME=`Debian` +-- DEBIAN6_USED_FALLBACK_SCRIPT=`.*/Modules/Internal/OSRelease/020-TryDebianVersion.cmake` -- DEBIAN6_VERSION=`6\.0\.10` -- DEBIAN6_VERSION_ID=`6\.0\.10` diff --git a/Tests/RunCMake/cmake_host_system_information/UserFallbackScript-stdout.txt b/Tests/RunCMake/cmake_host_system_information/UserFallbackScript-stdout.txt index afcc000..acaf47e 100644 --- a/Tests/RunCMake/cmake_host_system_information/UserFallbackScript-stdout.txt +++ b/Tests/RunCMake/cmake_host_system_information/UserFallbackScript-stdout.txt @@ -2,5 +2,6 @@ -- UFS_ID_LIKE=`nothing` -- UFS_NAME=`UnitTest` -- UFS_PRETTY_NAME=`Just a Unit Test` +-- UFS_USED_FALLBACK_SCRIPT=`.*/999-LastFallbackScript\.cmake` -- UFS_VERSION=`0\.0\.1` -- UFS_VERSION_ID=`0\.0\.1` -- cgit v0.12