cmake FEATURE coverage checks gcc and gcov versions
diff --git a/CMakeModules/GenCoverage.cmake b/CMakeModules/GenCoverage.cmake
index 43a576b..55be637 100644
--- a/CMakeModules/GenCoverage.cmake
+++ b/CMakeModules/GenCoverage.cmake
@@ -40,6 +40,20 @@
message(WARNING "Compiler is not gcc! Coverage may break the tests!")
endif()
+ execute_process(
+ COMMAND bash "-c" "${CMAKE_C_COMPILER} --version | head -n1 | sed \"s/.* (.*) \\([0-9]\\+.[0-9]\\+.[0-9]\\+ .*\\)/\\1/\""
+ OUTPUT_VARIABLE GCC_VERSION_FULL
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ execute_process(
+ COMMAND bash "-c" "${PATH_GCOV} --version | head -n1 | sed \"s/.* (.*) \\([0-9]\\+.[0-9]\\+.[0-9]\\+ .*\\)/\\1/\""
+ OUTPUT_VARIABLE GCOV_VERSION_FULL
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(NOT GCC_VERSION_FULL STREQUAL GCOV_VERSION_FULL)
+ message(WARNING "gcc and gcov versions do not match! Generating coverage may fail with errors.")
+ endif()
+
# add specific required compile flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -fprofile-arcs -ftest-coverage")
endif()