From 088262dfeeca08e358a148357d002ba7fb55e132 Mon Sep 17 00:00:00 2001 From: Anthony Roberts Date: Thu, 13 Feb 2025 19:59:31 +0100 Subject: [PATCH] Windows ARM64: Check and cache VSCMD version This uses the same technique as the one earlier in the file, that checks the `VCToolsRedistDir` env var Pull Request: https://projects.blender.org/blender/blender/pulls/134522 --- build_files/cmake/platform/platform_win32.cmake | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index af00f6670f5..5493df5e30d 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -59,9 +59,18 @@ else() endif() set(WINDOWS_ARM64_MIN_VSCMD_VER 17.12.3) +# We have a minimum version of VSCMD for ARM64 (ie, the version the libs were compiled against) +# This checks for the version on initial run, and caches it, so users do not have to run the VS CMD window every time if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64") - if($ENV{VSCMD_VER} VERSION_LESS WINDOWS_ARM64_MIN_VSCMD_VER) - message(FATAL_ERROR "Windows ARM64 requires VS2022 version ${WINDOWS_ARM64_MIN_VSCMD_VER} or greater - please update your VS2022 install!") + set(VC_VSCMD_VER $ENV{VSCMD_VER} CACHE STRING "Version of the VSCMD initially run from") + mark_as_advanced(VC_VSCMD_VER) + set(VSCMD_VER ${VC_VSCMD_VER}) + if(DEFINED VSCMD_VER) + if(VSCMD_VER VERSION_LESS WINDOWS_ARM64_MIN_VSCMD_VER) + message(FATAL_ERROR "Windows ARM64 requires VS2022 version ${WINDOWS_ARM64_MIN_VSCMD_VER} or greater - please update your VS2022 install!") + endif() + else() + message(FATAL_ERROR "Unable to detect the Visual Studio CMD version, try running from the visual studio developer prompt.") endif() endif()