Quellcode durchsuchen

Tune coverage collecting procedure

Alexey Edelev vor 4 Jahren
Ursprung
Commit
e508b9c53f

+ 1 - 0
CMakeLists.txt

@@ -19,6 +19,7 @@ set(QT_PROTOBUF_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
 set(QT_PROTOBUF_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
 
 include("${QT_PROTOBUF_CMAKE_DIR}/dependencies.cmake")
+include("${QT_PROTOBUF_CMAKE_DIR}/Coverage.cmake" EXCLUDE_FROM_ALL)
 
 set(GENERATOR_TARGET qtprotobufgen)
 set(PROTOBUF_QUICK_PLUGIN_NAME protobufquickplugin)

+ 2 - 6
cmake/Coverage.cmake

@@ -1,13 +1,8 @@
-if(DEFINED $ENV{QT_PROTOBUF_MAKE_COVERAGE})
-    set(QT_PROTOBUF_MAKE_COVERAGE $ENV{QT_PROTOBUF_MAKE_COVERAGE})
-elseif(NOT DEFINED QT_PROTOBUF_MAKE_COVERAGE)
-    set(QT_PROTOBUF_MAKE_COVERAGE OFF)
-endif()
-
 if(QT_PROTOBUF_MAKE_COVERAGE AND UNIX)
     message(STATUS "Enable gcov")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
     set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
+    add_custom_target(coverage)
 endif()
 
 function(add_coverage_target)
@@ -37,5 +32,6 @@ function(add_coverage_target)
                 ${CMAKE_SOURCE_DIR} --html --html-details -o ${GCOVR_OUTPUT_DIR}/${add_coverage_target_TARGET}.html ${OBJECTS_DIR} .
                 WORKING_DIRECTORY ${GCOV_OUTPUT_DIR})
         endif()
+        add_dependencies(coverage ${COVERAGE_TARGET})
     endif()
 endfunction(add_coverage_target)

+ 0 - 1
src/grpc/CMakeLists.txt

@@ -26,7 +26,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE})
 set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
-include(${QT_PROTOBUF_CMAKE_DIR}/Coverage.cmake)
 include(${QT_PROTOBUF_CMAKE_DIR}/GenerateQtHeaders.cmake)
 include(${QT_PROTOBUF_CMAKE_DIR}/QtProtobufCommon.cmake)
 

+ 0 - 1
src/protobuf/CMakeLists.txt

@@ -28,7 +28,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE})
 set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
-include(${QT_PROTOBUF_CMAKE_DIR}/Coverage.cmake)
 include(${QT_PROTOBUF_CMAKE_DIR}/GenerateQtHeaders.cmake)
 include(${QT_PROTOBUF_CMAKE_DIR}/QtProtobufCommon.cmake)
 

+ 0 - 1
src/qttypes/CMakeLists.txt

@@ -23,7 +23,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE})
 set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
-include(${QT_PROTOBUF_CMAKE_DIR}/Coverage.cmake)
 include(${QT_PROTOBUF_CMAKE_DIR}/GenerateQtHeaders.cmake)
 
 file(GLOB SOURCES

+ 0 - 1
src/wellknowntypes/CMakeLists.txt

@@ -23,7 +23,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE})
 set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
-include(${QT_PROTOBUF_CMAKE_DIR}/Coverage.cmake)
 include(${QT_PROTOBUF_CMAKE_DIR}/GenerateQtHeaders.cmake)
 
 file(GLOB SOURCES