Skip to content

Commit 88a97f3

Browse files
authored
Fix whole program optimization option for Windows (#91759)
The recent change to cleanup the way some options in Windows builds of the runtime are overriden missed the fact that the CMAKE_INTERPROCEDURAL_OPTIMIZATION cannot contain generator expressions and so it was always set to "off". The fix is to set CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE and CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBUGINFO instead. I have also missed two places before where we were still adding /GL-.
1 parent 773c180 commit 88a97f3

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

eng/native/configurecompiler.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,9 @@ if (MSVC)
856856
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Gz>)
857857
endif (CLR_CMAKE_HOST_ARCH_I386)
858858

859-
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION $<AND:$<COMPILE_LANGUAGE:C,CXX>,$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>>)
859+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
860+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF)
861+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_CHECKED OFF)
860862

861863
if (CLR_CMAKE_HOST_ARCH_AMD64)
862864
# The generator expression in the following command means that the /homeparams option is added only for debug builds for C and C++ source files

src/native/libs/System.Globalization.Native/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ if(CLR_CMAKE_TARGET_WIN32)
173173
STATIC
174174
${NATIVEGLOBALIZATION_SOURCES}
175175
)
176-
target_compile_options(System.Globalization.Native.Aot.GuardCF PRIVATE /GL-)
176+
set_target_properties(System.Globalization.Native.Aot.GuardCF PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
177177

178178
install_static_library(System.Globalization.Native.Aot aotsdk nativeaot)
179179
install_static_library(System.Globalization.Native.Aot.GuardCF aotsdk nativeaot)

src/native/libs/System.IO.Compression.Native/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ else ()
147147
STATIC
148148
${NATIVECOMPRESSION_SOURCES}
149149
)
150-
target_compile_options(System.IO.Compression.Native.Aot.GuardCF PRIVATE /GL-)
150+
set_target_properties(System.IO.Compression.Native.Aot.GuardCF PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
151151
endif()
152152

153153
if (GEN_SHARED_LIB)

0 commit comments

Comments
 (0)