File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,17 @@ endif()
41
41
# It is very useful for IDE integration, linting, etc
42
42
set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
43
43
44
+ # CMake typically defaults to -O2 for RelWithDebInfo, which can
45
+ # result in slight differences when comparing to Release when
46
+ # profiling or analysing the resulting assembly
47
+ # See https://stackoverflow.com/a/59314670
48
+ if (SOURCEMETA_COMPILER_LLVM OR SOURCEMETA_COMPILER_GCC )
49
+ set (CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g" CACHE STRING "Optimization level for RelWithDebInfo (C)" FORCE )
50
+ set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g" CACHE STRING "Optimization level for RelWithDebInfo (C++)" FORCE )
51
+ set (CMAKE_OBJC_FLAGS_RELWITHDEBINFO "-O3 -g" CACHE STRING "Optimization level for RelWithDebInfo (Objective-C)" FORCE )
52
+ set (CMAKE_OBJCXX_FLAGS_RELWITHDEBINFO "-O3 -g" CACHE STRING "Optimization level for RelWithDebInfo (Objective-C++)" FORCE )
53
+ endif ()
54
+
44
55
# Prevent DT_RPATH/DT_RUNPATH problem
45
56
# This problem is not present on Apple platforms.
46
57
# See https://www.youtube.com/watch?v=m0DwB4OvDXk
You can’t perform that action at this time.
0 commit comments