diff --git a/CMakeLists.txt b/CMakeLists.txt index 09c738bd7..013a61f15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,8 +46,13 @@ add_compile_options($<$:-fpermissive>) add_compile_options(-Wno-unused-function -Wno-deprecated-declarations -Wno-unknown-pragmas) if (WITH_COVERAGE) - add_compile_options( --coverage -g0 ) - link_libraries( --coverage ) + if (USING_CLANG) + add_compile_options( -fprofile-instr-generate -fcoverage-mapping ) + link_libraries( -fprofile-instr-generate ) + else() + add_compile_options( --coverage -g0 ) + link_libraries( --coverage ) + endif() endif() # these vars are set by the cmake toolchain spec