Skip to content

Commit e6b60dd

Browse files
committed
Don't enable WMO on Windows
1 parent 79d4dd7 commit e6b60dd

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ if(NOT SWIFT_SYSTEM_NAME)
3535
endif()
3636
endif()
3737

38-
# Enable whole module optimization for release builds & incremental for debug builds
39-
if(POLICY CMP0157)
40-
set(CMAKE_Swift_COMPILATION_MODE "$<IF:$<CONFIG:Release>,wholemodule,incremental>")
41-
else()
42-
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:Swift>,$<CONFIG:Release>>:-wmo>)
38+
# Don't enable WMO on Windows due to linker failures
39+
if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
40+
# Enable whole module optimization for release builds & incremental for debug builds
41+
if(POLICY CMP0157)
42+
set(CMAKE_Swift_COMPILATION_MODE "$<IF:$<CONFIG:Release>,wholemodule,incremental>")
43+
else()
44+
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:Swift>,$<CONFIG:Release>>:-wmo>)
45+
endif()
4346
endif()
4447

4548
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

0 commit comments

Comments
 (0)