Files
dotnet-runtime/eng/native/configureoptimization.cmake
Bruce Forstall f21a3155c2 Switch Windows Checked build to -O2 from -O1 (#59235)
That is, optimize for speed, not for size.

Don't do this for Windows x86, due to
https://github.com/dotnet/runtime/issues/59845
2021-10-06 22:15:14 -07:00

18 lines
927 B
CMake

if(CLR_CMAKE_HOST_WIN32)
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Debug>>:/Od>)
if (CLR_CMAKE_HOST_ARCH_I386)
# The Windows x86 Checked CLR has some kind of problem with exception handling
# when compiled with /O2. Issue: https://github.com/dotnet/runtime/issues/59845.
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Checked>>:/O1>)
else()
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Checked>>:/O2>)
endif()
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Release>>:/Ox>)
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:RelWithDebInfo>>:/O2>)
elseif(CLR_CMAKE_HOST_UNIX)
add_compile_options($<$<CONFIG:Debug>:-O0>)
add_compile_options($<$<CONFIG:Checked>:-O2>)
add_compile_options($<$<CONFIG:Release>:-O3>)
add_compile_options($<$<CONFIG:RelWithDebInfo>:-O2>)
endif()