File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -630,6 +630,10 @@ if("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQU
630
630
endif ()
631
631
632
632
if (NOT SWIFT_COMPILER_IS_MSVC_LIKE )
633
+ # CMake's default for CMAKE_CXX_FLAGS_DBEUG is "-g". Let's add "-O0", because we want to be able
634
+ # to append CMAKE_CXX_FLAGS_DEBUG to a list of compile flags that already contains a -O flag.
635
+ set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0" )
636
+
633
637
# CMake's default for CMAKE_CXX_FLAGS_RELEASE is "-O3 -DNDEBUG". Let's avoid "-O3" for consistency
634
638
# between Release and RelWithDebInfo. Dropping -DNDEBUG from this setting is blocked by triggering
635
639
# a test failure of Swift-Unit :: Syntax/./SwiftSyntaxTests/TypeSyntaxTests.MetatypeTypeWithAPIs
Original file line number Diff line number Diff line change @@ -133,7 +133,9 @@ function(_add_host_variant_c_compile_flags target)
133
133
is_build_type_with_debuginfo ("${CMAKE_BUILD_TYPE} " debuginfo )
134
134
135
135
# Add -O0/-O2/-O3/-Os/-g/-momit-leaf-frame-pointer/... based on CMAKE_BUILD_TYPE.
136
- target_compile_options (${target} PRIVATE "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE} }" )
136
+ string (TOUPPER ${CMAKE_BUILD_TYPE} build_type_upper )
137
+ string (REPLACE " " ";" cxx_flags_list "${CMAKE_CXX_FLAGS_${build_type_upper} }" )
138
+ target_compile_options (${target} PRIVATE ${cxx_flags_list} )
137
139
138
140
if (optimized )
139
141
# Omit leaf frame pointers on x86 production builds (optimized, no debug
Original file line number Diff line number Diff line change @@ -167,7 +167,9 @@ function(_add_target_variant_c_compile_flags)
167
167
is_build_type_with_debuginfo ("${CFLAGS_BUILD_TYPE} " debuginfo )
168
168
169
169
# Add -O0/-O2/-O3/-Os/-g/... based on CFLAGS_BUILD_TYPE.
170
- list (APPEND result "${CMAKE_CXX_FLAGS_${CFLAGS_BUILD_TYPE} }" )
170
+ string (TOUPPER ${CFLAGS_BUILD_TYPE} build_type_upper )
171
+ string (REPLACE " " ";" cxx_flags_list "${CMAKE_CXX_FLAGS_${build_type_upper} }" )
172
+ list (APPEND result ${cxx_flags_list} )
171
173
172
174
if (optimized )
173
175
# Omit leaf frame pointers on x86 production builds (optimized, no debug
You can’t perform that action at this time.
0 commit comments