Add code coverage info support
This commit is contained in:
@@ -30,6 +30,7 @@ option(ICU "ICU support for convert codepages" ${_ICU_DEFAULT})
|
||||
option(STD_IOSTREAM "Building with std iostream operators support" OFF)
|
||||
option(INTROSPECTION "Build with introspection" OFF)
|
||||
option(TESTS "Build tests and perform their before install step" OFF)
|
||||
option(COVERAGE "Build project with coverage info" OFF)
|
||||
set(PIP_UTILS 1)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
@@ -215,6 +216,18 @@ else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall")
|
||||
endif()
|
||||
|
||||
set(PIP_COVERAGE "no")
|
||||
if (COVERAGE)
|
||||
find_program(GCOV_EXECUTABLE gcov)
|
||||
if (GCOV_EXECUTABLE)
|
||||
set(PIP_COVERAGE "yes")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
|
||||
else()
|
||||
message(STATUS "GCOV_EXECUTABLE: not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# Check if std::iostream operators support
|
||||
set(PIP_STD_IOSTREAM "no")
|
||||
@@ -595,6 +608,7 @@ message(" std::iostream: ${PIP_STD_IOSTREAM}")
|
||||
message(" ICU strings : ${PIP_ICU}")
|
||||
message(" Timer types : ${PIP_TIMERS}")
|
||||
message(" Introspection: ${PIP_INTROSPECTION}")
|
||||
message(" Coverage : ${PIP_COVERAGE}")
|
||||
if(INTROSPECTION)
|
||||
message(STATUS " Warning: Introspection reduces the performance!")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user