From b41eda671dcc892b1b4851a9fa78405c4a4b1110 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Thu, 22 Feb 2024 16:47:27 -0800 Subject: [PATCH] Hotfix for CMake switch order (#457) --- build/CompilerAndLinker.cmake | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/build/CompilerAndLinker.cmake b/build/CompilerAndLinker.cmake index 9a9612f4..ee290fc3 100644 --- a/build/CompilerAndLinker.cmake +++ b/build/CompilerAndLinker.cmake @@ -81,12 +81,12 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") if(CMAKE_INTERPROCEDURAL_OPTIMIZATION) message(STATUS "Building using Whole Program Optimization") - list(APPEND /Gy /Gw) + list(APPEND COMPILER_SWITCHES /Gy /Gw) endif() if(OpenMP_CXX_FOUND) # OpenMP in MSVC is not compatible with /permissive- unless you disable two-phase lookup - list(APPEND /Zc:twoPhase-) + list(APPEND COMPILER_SWITCHES /Zc:twoPhase-) endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24) @@ -95,9 +95,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26) AND (NOT (XBOX_CONSOLE_TARGET STREQUAL "durango"))) - foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME}) - target_compile_options(${t} PRIVATE /Zc:preprocessor /wd5104 /wd5105) - endforeach() + list(APPEND COMPILER_SWITCHES /Zc:preprocessor /wd5104 /wd5105) endif() if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm"))) @@ -110,10 +108,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.31) AND (XBOX_CONSOLE_TARGET STREQUAL "durango")) - - foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME}) - target_compile_options(${t} PRIVATE /Zc:static_assert-) - endforeach() + list(APPEND COMPILER_SWITCHES /Zc:static_assert-) endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.35)