Skip to content

Commit ca971ac

Browse files
authored
Hotfix for CMake switch order (#216)
1 parent 8a3efc2 commit ca971ac

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

build/CompilerAndLinker.cmake

+5-9
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ if(MSVC)
4545

4646
if((MSVC_VERSION GREATER_EQUAL 1928)
4747
AND (CMAKE_SIZEOF_VOID_P EQUAL 8)
48+
AND (NOT (TARGET OpenEXR::OpenEXR))
4849
AND ((NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM")) OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)))
4950
list(APPEND COMPILER_SWITCHES "$<$<NOT:$<CONFIG:DEBUG>>:/guard:ehcont>")
5051
list(APPEND LINKER_SWITCHES "$<$<NOT:$<CONFIG:DEBUG>>:/guard:ehcont>")
@@ -80,12 +81,12 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
8081

8182
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
8283
message(STATUS "Building using Whole Program Optimization")
83-
list(APPEND /Gy /Gw)
84+
list(APPEND COMPILER_SWITCHES /Gy /Gw)
8485
endif()
8586

8687
if(OpenMP_CXX_FOUND)
8788
# OpenMP in MSVC is not compatible with /permissive- unless you disable two-phase lookup
88-
list(APPEND /Zc:twoPhase-)
89+
list(APPEND COMPILER_SWITCHES /Zc:twoPhase-)
8990
endif()
9091

9192
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.24)
@@ -94,9 +95,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
9495

9596
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26)
9697
AND (NOT (XBOX_CONSOLE_TARGET STREQUAL "durango")))
97-
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
98-
target_compile_options(${t} PRIVATE /Zc:preprocessor /wd5104 /wd5105)
99-
endforeach()
98+
list(APPEND COMPILER_SWITCHES /Zc:preprocessor /wd5104 /wd5105)
10099
endif()
101100

102101
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm")))
@@ -109,10 +108,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
109108

110109
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.31)
111110
AND (XBOX_CONSOLE_TARGET STREQUAL "durango"))
112-
113-
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
114-
target_compile_options(${t} PRIVATE /Zc:static_assert-)
115-
endforeach()
111+
list(APPEND COMPILER_SWITCHES /Zc:static_assert-)
116112
endif()
117113

118114
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.35)

0 commit comments

Comments
 (0)