cmake: coverage: disable compiler optimization for COVERAGE build 63/17163/1
authorMatt Ranostay <matt.ranostay@konsulko.com>
Thu, 11 Oct 2018 06:01:20 +0000 (14:01 +0800)
committerMatt Ranostay <matt.ranostay@konsulko.com>
Thu, 11 Oct 2018 06:09:03 +0000 (14:09 +0800)
Switch to -O0 compile option to allow more accurate coverage reports
that function inlining and OOO execution can skew.

Bug-AGL: SPEC-1807
Change-Id: If3ea7e9fe931ac9087d4c4966d0b3ca77308eaf7
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
cmake/cmake.d/01-build_options.cmake

index 26b001d..abd6734 100644 (file)
@@ -90,7 +90,7 @@ endforeach()
 ##################################################
 set(PROFILING_COMPILE_OPTIONS -g -O0 -pg -Wp,-U_FORTIFY_SOURCE CACHE STRING "Compilation flags for PROFILING build type.")
 set(DEBUG_COMPILE_OPTIONS -g -ggdb CACHE STRING "Compilation flags for DEBUG build type.")
-set(COVERAGE_COMPILE_OPTIONS -g --coverage CACHE STRING "Compilation flags for COVERAGE build type.")
+set(COVERAGE_COMPILE_OPTIONS -g -O0 --coverage CACHE STRING "Compilation flags for COVERAGE build type.")
 set(RELEASE_COMPILE_OPTIONS -O2 -D_FORTIFY_SOURCE=2 CACHE STRING "Compilation flags for RELEASE build type.")
 foreach(option ${PROFILING_COMPILE_OPTIONS})
        add_compile_options($<$<CONFIG:PROFILING>:${option}>)