Properly fix #840

The problem was probably caused by
the absence of -lgcov as a linker option.
With this I'm replacing
-fprofile-arcs -ftest-coverage and the linker options
with --coverage, that passes all the correct flags
to compiler and linker.
parent 16cce3af
...@@ -19,7 +19,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) ...@@ -19,7 +19,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
include(CheckAtomic) include(CheckAtomic)
if(CMAKE_BUILD_TYPE MATCHES "Debug") if(CMAKE_BUILD_TYPE MATCHES "Debug")
add_compile_options(-g -Og -ftest-coverage -fstack-protector-all --param=ssp-buffer-size=4) add_compile_options(-g -Og --coverage -fstack-protector-all --param=ssp-buffer-size=4)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13")
add_link_options(--coverage)
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()
endif() endif()
option(BUILD_SHARED_LIBS "build shared library" ON) option(BUILD_SHARED_LIBS "build shared library" ON)
...@@ -51,8 +56,8 @@ if (PISTACHE_BUILD_TESTS) ...@@ -51,8 +56,8 @@ if (PISTACHE_BUILD_TESTS)
APPEND CMAKE_CXX_CPPCHECK APPEND CMAKE_CXX_CPPCHECK
"--enable=all" "--enable=all"
"-DCPPCHECK" "-DCPPCHECK"
"--suppress=*:${PROJECT_SOURCE_DIR}/third-party*" "--suppress=*:${PROJECT_SOURCE_DIR}/third-party/*"
"--suppress=*:${PROJECT_SOURCE_DIR}/tests*" "--suppress=*:${PROJECT_SOURCE_DIR}/tests/*"
"--suppress=noExplicitConstructor:include/pistache/optional.h" "--suppress=noExplicitConstructor:include/pistache/optional.h"
) )
else() else()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment