mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-24 16:40:21 +00:00
CMake: Respect any optimization level specified in the CXXFLAGS value
This change makes the build respect any valid optimization level specified with the -O flag in the CXXFLAGS environment variable. Otherwise, without this change, the build ignores any optimization level specified with the -O flag in the CXXFLAGS environment variable — which prevents use of -O0 to build without any optimizations. And one effect of not being able to disable optimizations is that trying to check certain frame variables in lldb can result in an error of this form: > error: Couldn't look up symbols: __ZN2AK6Detail10StringBaseD2Ev > Hint: The expression tried to call a function that is not present in > the target, perhaps because it was optimized out by the compiler.
This commit is contained in:
parent
42b31820a6
commit
b1f1f319d7
1 changed files with 10 additions and 2 deletions
|
@ -29,9 +29,17 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|||
if (NOT MSVC)
|
||||
add_cxx_compile_options(-ggdb3)
|
||||
endif()
|
||||
add_cxx_compile_options(-Og)
|
||||
if ("$ENV{CXXFLAGS}" MATCHES "(^| )(-O(fast|.?))( |$)")
|
||||
add_cxx_compile_options(${CMAKE_MATCH_0})
|
||||
else ()
|
||||
add_cxx_compile_options(-Og)
|
||||
endif()
|
||||
else()
|
||||
add_cxx_compile_options(-O2)
|
||||
if ("$ENV{CXXFLAGS}" MATCHES "(^| )(-O(fast|.?))( |$)")
|
||||
add_cxx_compile_options(${CMAKE_MATCH_0})
|
||||
else ()
|
||||
add_cxx_compile_options(-O2)
|
||||
endif()
|
||||
if (NOT MSVC)
|
||||
add_cxx_compile_options(-g1)
|
||||
endif()
|
||||
|
|
Loading…
Reference in a new issue