aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeramat Jokar <keramatjokar8855@gmail.com>2024-10-04 20:49:58 +0330
committerShauren <shauren.trinity@gmail.com>2025-08-30 22:55:25 +0200
commit9dff954ca7b04483238aa3aeaf6f77095aad9507 (patch)
tree35ac39c481227372cbd7da7ce0e6c2e05da1b2c0
parenta3874ee4f931336fa1ae240fe3288bc648b5d5c2 (diff)
Build: Add more detailed windows release name to revision_data.h (#30310)
(cherry picked from commit 83ca87d39eca0fdb71895d4774189bbb5fa89b3e)
-rw-r--r--cmake/genrev.cmake9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmake/genrev.cmake b/cmake/genrev.cmake
index 8ecd7ec4a7d..ba0d930b839 100644
--- a/cmake/genrev.cmake
+++ b/cmake/genrev.cmake
@@ -126,14 +126,15 @@ cmake_host_system_information(RESULT TRINITY_BUILD_HOST_SYSTEM QUERY OS_NAME)
cmake_host_system_information(RESULT TRINITY_BUILD_HOST_DISTRO QUERY DISTRIB_INFO)
cmake_host_system_information(RESULT TRINITY_BUILD_HOST_SYSTEM_RELEASE QUERY OS_RELEASE)
# on windows OS_RELEASE contains sub-type string tag like "Professional" instead of a version number and OS_VERSION has only build number
-# so we grab that from cmd "ver" command
+# so we grab that with Get-CimInstance powershell cmdlet
if(WIN32)
execute_process(
- COMMAND cmd /c ver
+ COMMAND powershell -NoProfile -Command "$v=(Get-CimInstance -ClassName Win32_OperatingSystem); '{0} ({1})' -f $v.Caption, $v.Version"
OUTPUT_VARIABLE TRINITY_BUILD_HOST_SYSTEM_RELEASE
+ OUTPUT_STRIP_TRAILING_WHITESPACE
)
- string(STRIP ${TRINITY_BUILD_HOST_SYSTEM_RELEASE} TRINITY_BUILD_HOST_SYSTEM_RELEASE)
- string(REGEX MATCH "[0-9]+[.][0-9]+[.][0-9]+" TRINITY_BUILD_HOST_SYSTEM_RELEASE ${TRINITY_BUILD_HOST_SYSTEM_RELEASE})
+ # Remove "Microsoft Windows" from the result
+ string(REPLACE "Microsoft Windows " "" TRINITY_BUILD_HOST_SYSTEM_RELEASE ${TRINITY_BUILD_HOST_SYSTEM_RELEASE})
endif()
if(CMAKE_SCRIPT_MODE_FILE)