@@ -144,7 +144,8 @@ if(CODE_COVERAGE AND NOT CODE_COVERAGE_ADDED)
144144 COMMAND ;
145145 COMMENT "libs ready for coverage report." )
146146
147- elseif (CMAKE_COMPILER_IS_GNUCXX)
147+ elseif (CMAKE_C_COMPILER_ID MATCHES "GNU"
148+ OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
148149 # Messages
149150 message (STATUS "Building with lcov Code Coverage Tools" )
150151
@@ -259,7 +260,8 @@ function(target_code_coverage TARGET_NAME)
259260 ${TARGET_VISIBILITY}
260261 -fprofile-instr-generate
261262 -fcoverage-mapping)
262- elseif (CMAKE_COMPILER_IS_GNUCXX)
263+ elseif (CMAKE_C_COMPILER_ID MATCHES "GNU"
264+ OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
263265 target_compile_options (
264266 ${TARGET_NAME}
265267 ${TARGET_VISIBILITY}
@@ -370,7 +372,8 @@ function(target_code_coverage TARGET_NAME)
370372 -format="html" ${EXCLUDE_REGEX}
371373 DEPENDS ccov-processing-${target_code_coverage_COVERAGE_TARGET_NAME} )
372374
373- elseif (CMAKE_COMPILER_IS_GNUCXX)
375+ elseif (CMAKE_C_COMPILER_ID MATCHES "GNU"
376+ OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
374377 set (COVERAGE_INFO
375378 "${CMAKE_COVERAGE_OUTPUT_DIRECTORY} /${target_code_coverage_COVERAGE_TARGET_NAME} .info"
376379 )
@@ -439,7 +442,8 @@ function(target_code_coverage TARGET_NAME)
439442 endif ()
440443 add_dependencies (ccov ccov-${target_code_coverage_COVERAGE_TARGET_NAME} )
441444
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" )
443447 if (NOT TARGET ccov-report)
444448 add_custom_target (ccov-report)
445449 endif ()
@@ -473,7 +477,8 @@ function(add_code_coverage)
473477 OR CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang" )
474478 add_compile_options (-fprofile-instr-generate -fcoverage-mapping)
475479 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" )
477482 add_compile_options (-fprofile-arcs -ftest-coverage)
478483 link_libraries (gcov)
479484 endif ()
@@ -552,7 +557,8 @@ function(add_code_coverage_all_targets)
552557 -format="html" ${EXCLUDE_REGEX}
553558 DEPENDS ccov-all -processing)
554559
555- elseif (CMAKE_COMPILER_IS_GNUCXX)
560+ elseif (CMAKE_C_COMPILER_ID MATCHES "GNU"
561+ OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
556562 set (COVERAGE_INFO "${CMAKE_COVERAGE_OUTPUT_DIRECTORY} /all-merged.info" )
557563
558564 # Nothing required for gcov
0 commit comments