@@ -144,7 +144,8 @@ if(CODE_COVERAGE AND NOT CODE_COVERAGE_ADDED)
144
144
COMMAND ;
145
145
COMMENT "libs ready for coverage report." )
146
146
147
- elseif (CMAKE_COMPILER_IS_GNUCXX )
147
+ elseif (CMAKE_C_COMPILER_ID MATCHES "GNU"
148
+ OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
148
149
# Messages
149
150
message (STATUS "Building with lcov Code Coverage Tools" )
150
151
@@ -259,7 +260,8 @@ function(target_code_coverage TARGET_NAME)
259
260
${TARGET_VISIBILITY}
260
261
-fprofile-instr-generate
261
262
-fcoverage-mapping )
262
- elseif (CMAKE_COMPILER_IS_GNUCXX )
263
+ elseif (CMAKE_C_COMPILER_ID MATCHES "GNU"
264
+ OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
263
265
target_compile_options (
264
266
${TARGET_NAME}
265
267
${TARGET_VISIBILITY}
@@ -370,7 +372,8 @@ function(target_code_coverage TARGET_NAME)
370
372
-format= "html" ${EXCLUDE_REGEX}
371
373
DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME} )
372
374
373
- elseif (CMAKE_COMPILER_IS_GNUCXX )
375
+ elseif (CMAKE_C_COMPILER_ID MATCHES "GNU"
376
+ OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
374
377
set (COVERAGE_INFO
375
378
"${CMAKE_COVERAGE_OUTPUT_DIRECTORY} /${target_code_coverage_COVERAGE_TARGET_NAME} .info"
376
379
)
@@ -439,7 +442,8 @@ function(target_code_coverage TARGET_NAME)
439
442
endif ()
440
443
add_dependencies (ccov ccov-${target_code_coverage_COVERAGE_TARGET_NAME} )
441
444
442
- if (NOT CMAKE_COMPILER_IS_GNUCXX )
445
+ if (NOT CMAKE_C_COMPILER_ID MATCHES "GNU"
446
+ OR NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
443
447
if (NOT TARGET ccov-report )
444
448
add_custom_target (ccov-report )
445
449
endif ()
@@ -473,7 +477,8 @@ function(add_code_coverage)
473
477
OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang" )
474
478
add_compile_options (-fprofile-instr-generate -fcoverage-mapping )
475
479
add_link_options (-fprofile-instr-generate -fcoverage-mapping )
476
- elseif (CMAKE_COMPILER_IS_GNUCXX )
480
+ elseif (CMAKE_C_COMPILER_ID MATCHES "GNU"
481
+ OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
477
482
add_compile_options (-fprofile-arcs -ftest-coverage )
478
483
link_libraries (gcov )
479
484
endif ()
@@ -552,7 +557,8 @@ function(add_code_coverage_all_targets)
552
557
-format= "html" ${EXCLUDE_REGEX}
553
558
DEPENDS ccov-all-processing )
554
559
555
- elseif (CMAKE_COMPILER_IS_GNUCXX )
560
+ elseif (CMAKE_C_COMPILER_ID MATCHES "GNU"
561
+ OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
556
562
set (COVERAGE_INFO "${CMAKE_COVERAGE_OUTPUT_DIRECTORY} /all-merged.info" )
557
563
558
564
# Nothing required for gcov
0 commit comments