Refactor our CMake flag handling to make it more flexible and reduce repetition: - Rename update_cxx_flags() to update_build_flags() to better reflect its expanded purpose - Generate CMake variable names internally based on configuration type instead of requiring callers to specify full variable names - Follow CMake's standard naming conventions for configuration-specific flags, see https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html#variable:CMAKE_%3CLANG%3E_FLAGS - Prepare groundwork for handling linker flags in addition to compiler flags in future changes Signed-off-by: Kefu Chai <kefu.chai@scylladb.com> Closes scylladb/scylladb#23842
26 lines
698 B
CMake
26 lines
698 B
CMake
set(CMAKE_CXX_FLAGS_COVERAGE
|
|
"-fprofile-instr-generate -fcoverage-mapping -fprofile-list=${CMAKE_SOURCE_DIR}/coverage_sources.list"
|
|
CACHE
|
|
INTERNAL
|
|
"")
|
|
update_build_flags(Coverage
|
|
WITH_DEBUG_INFO
|
|
OPTIMIZATION_LEVEL "g")
|
|
|
|
set(scylla_build_mode_Coverage "coverage")
|
|
set(Seastar_DEFINITIONS_COVERAGE
|
|
SCYLLA_BUILD_MODE=${scylla_build_mode_Coverage}
|
|
DEBUG
|
|
SANITIZE
|
|
DEBUG_LSA_SANITIZER
|
|
SCYLLA_ENABLE_ERROR_INJECTION)
|
|
foreach(definition ${Seastar_DEFINITIONS_COVERAGE})
|
|
add_compile_definitions(
|
|
$<$<CONFIG:Coverage>:${definition}>)
|
|
endforeach()
|
|
|
|
set(CMAKE_STATIC_LINKER_FLAGS_COVERAGE
|
|
"-fprofile-instr-generate -fcoverage-mapping")
|
|
|
|
maybe_limit_stack_usage_in_KB(40 Coverage)
|