Skip to content

Commit 6393159

Browse files
authored
CMake check for mismatch of toolset and arch setting (#221)
1 parent ff7481e commit 6393159

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

build/CompilerAndLinker.cmake

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ else()
4545
set(DIRECTX_HOST_ARCH x64)
4646
endif()
4747

48+
#--- Check DIRECTX_ARCH value
49+
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
50+
if(DIRECTX_ARCH MATCHES "x86|^arm$")
51+
message(FATAL_ERROR "64-bit toolset mismatch detected for DIRECTX_ARCH setting")
52+
endif()
53+
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
54+
if(DIRECTX_ARCH MATCHES "x64|arm64")
55+
message(FATAL_ERROR "32-bit toolset mismatch detected for DIRECTX_ARCH setting")
56+
endif()
57+
endif()
58+
4859
#--- Build with Unicode Win32 APIs per "UTF-8 Everywhere"
4960
if(WIN32)
5061
list(APPEND COMPILER_DEFINES _UNICODE UNICODE)
@@ -166,10 +177,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
166177
list(APPEND COMPILER_SWITCHES /Zc:lambda)
167178
endif()
168179

169-
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29)
170-
AND (NOT VCPKG_TOOLCHAIN))
171-
list(APPEND COMPILER_SWITCHES /external:W4)
172-
endif()
180+
# GDKX scenarios can't use external:W4
173181

174182
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.31)
175183
AND (XBOX_CONSOLE_TARGET STREQUAL "durango"))

0 commit comments

Comments
 (0)