build: put coverage items in more sane locations
This commit is contained in:
parent
d3e5a94861
commit
48ee839357
3 changed files with 23 additions and 23 deletions
|
|
@ -18,6 +18,7 @@ endif()
|
|||
|
||||
#Project level options
|
||||
option(BUILD_INSTALLER "Build installer" ON)
|
||||
option(ENABLE_COVERAGE "Enable test coverage" OFF)
|
||||
if(UNIX)
|
||||
if(APPLE)
|
||||
option(BUILD_OSX_BUNDLE "Build mac os bundle" ON)
|
||||
|
|
@ -198,6 +199,16 @@ message(STATUS "Qt version: ${Qt6_VERSION}")
|
|||
include(cmake/Libraries.cmake)
|
||||
configure_libs()
|
||||
|
||||
if(ENABLE_COVERAGE)
|
||||
message(STATUS "Enabling code coverage")
|
||||
include(cmake/CodeCoverage.cmake)
|
||||
append_coverage_compiler_flags()
|
||||
# Apparently solves the bug in gcov where it returns negative counts and confuses gcovr.
|
||||
# > Got negative hit value in gcov line 'branch 2 taken -1' caused by a bug in gcov tool
|
||||
# Bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68080
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-update=atomic")
|
||||
endif()
|
||||
|
||||
if(BUILD_OSX_BUNDLE AND APPLE_CODESIGN_DEV)
|
||||
include(cmake/MacCodesign.cmake)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -32,28 +32,6 @@ macro(configure_libs)
|
|||
if(HAVE_FORMAT)
|
||||
add_definitions(-DHAVE_FORMAT)
|
||||
endif()
|
||||
|
||||
option(ENABLE_COVERAGE "Enable test coverage" OFF)
|
||||
if(ENABLE_COVERAGE)
|
||||
message(STATUS "Enabling code coverage")
|
||||
include(cmake/CodeCoverage.cmake)
|
||||
append_coverage_compiler_flags()
|
||||
set(test_exclude subprojects/* build/* src/unittests/*)
|
||||
set(test_src ${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
# Apparently solves the bug in gcov where it returns negative counts and confuses gcovr.
|
||||
# > Got negative hit value in gcov line 'branch 2 taken -1' caused by a bug in gcov tool
|
||||
# Bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68080
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-update=atomic")
|
||||
|
||||
setup_target_for_coverage_gcovr_xml(
|
||||
NAME coverage-legacytests
|
||||
EXECUTABLE legacytests
|
||||
BASE_DIRECTORY ${test_src}
|
||||
EXCLUDE ${test_exclude}
|
||||
)
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
#
|
||||
|
|
@ -80,7 +58,6 @@ macro(configure_unix_libs)
|
|||
message(FATAL_ERROR "Missing header: sys/socket.h")
|
||||
endif()
|
||||
|
||||
|
||||
check_include_files(unistd.h HAVE_UNISTD_H)
|
||||
if (NOT HAVE_UNISTD_H)
|
||||
message(FATAL_ERROR "Missing unistd.h")
|
||||
|
|
|
|||
|
|
@ -7,3 +7,15 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
|||
set(target legacytests)
|
||||
add_executable(${target} ${sources} ${headers})
|
||||
target_link_libraries(${target} ${test_libs} common)
|
||||
|
||||
if(ENABLE_COVERAGE)
|
||||
set(test_exclude subprojects/* build/* src/unittests/*)
|
||||
set(test_src ${PROJECT_SOURCE_DIR}/src)
|
||||
setup_target_for_coverage_gcovr_xml(
|
||||
NAME coverage-${target}
|
||||
EXECUTABLE ${target}
|
||||
BASE_DIRECTORY ${test_src}
|
||||
EXCLUDE ${test_exclude}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue