Skip to content

Commit cd2c471

Browse files
authored
Avoid CMake's default -O3 for Release builds
1 parent 7ccbc75 commit cd2c471

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,8 @@ if("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQU
629629
set(SWIFT_COMPILER_IS_MSVC_LIKE TRUE)
630630
endif()
631631

632+
# Avoid CMake's default -O3 for Release builds.
633+
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
632634
if(NOT SWIFT_COMPILER_IS_MSVC_LIKE)
633635
_compute_lto_flag("${SWIFT_TOOLS_ENABLE_LTO}" _lto_flag_out)
634636
if(_lto_flag_out)

0 commit comments

Comments
 (0)