From 318d841cd39db4b1a3fff4e82e6b622c9fb6aa28 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 15 Apr 2025 13:02:22 -0700 Subject: [PATCH] CMake check for mismatch of toolset and arch setting (#605) --- build/CompilerAndLinker.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build/CompilerAndLinker.cmake b/build/CompilerAndLinker.cmake index 69c0d13..a61b58a 100644 --- a/build/CompilerAndLinker.cmake +++ b/build/CompilerAndLinker.cmake @@ -45,6 +45,17 @@ else() set(DIRECTX_HOST_ARCH x64) endif() +#--- Check DIRECTX_ARCH value +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + if(DIRECTX_ARCH MATCHES "x86|^arm$") + message(FATAL_ERROR "64-bit toolset mismatch detected for DIRECTX_ARCH setting") + endif() +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + if(DIRECTX_ARCH MATCHES "x64|arm64") + message(FATAL_ERROR "32-bit toolset mismatch detected for DIRECTX_ARCH setting") + endif() +endif() + #--- Build with Unicode Win32 APIs per "UTF-8 Everywhere" if(WIN32) list(APPEND COMPILER_DEFINES _UNICODE UNICODE)