-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Update cmake Test Settings (#4)
* updated directory settings and target flags
- Loading branch information
Showing
2 changed files
with
36 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
add_executable( | ||
unit | ||
unit.cpp | ||
${CMAKE_SOURCE_DIR}/src/sigfn.c | ||
${CMAKE_SOURCE_DIR}/src/sigfn.cpp) | ||
${CMAKE_CURRENT_SOURCE_DIR}/../src/sigfn.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/../src/sigfn.cpp) | ||
|
||
target_include_directories(unit PRIVATE ${SIGFN_INCLUDE}) | ||
|
||
if(SIGFN_COVER) | ||
if(WIN32) | ||
message("skipping code coverage for windows") | ||
else() | ||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage -g -O0") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -g -O0") | ||
target_compile_options(unit PRIVATE -fprofile-arcs -ftest-coverage -g -O0) | ||
target_link_libraries(unit PRIVATE gcov "--coverage") | ||
add_custom_target( | ||
cover | ||
DEPENDS unit) | ||
add_custom_command( | ||
TARGET cover | ||
COMMAND gcovr -r ${CMAKE_SOURCE_DIR} -e ${CMAKE_SOURCE_DIR}/tests) | ||
endif() | ||
COMMAND gcovr -r ${CMAKE_CURRENT_SOURCE_DIR}/.. -e ${CMAKE_CURRENT_SOURCE_DIR}) | ||
endif() | ||
endif() | ||
|
||
add_test(NAME test_c_handle COMMAND unit HANDLE_C) | ||
add_test(NAME test_c_ignore COMMAND unit IGNORE_C) | ||
add_test(NAME test_c_reset COMMAND unit RESET_C) | ||
add_test(NAME test_cpp_handle COMMAND unit HANDLE_CPP) | ||
add_test(NAME test_cpp_ignore COMMAND unit IGNORE_CPP) | ||
add_test(NAME test_cpp_reset COMMAND unit RESET_CPP) | ||
add_test(NAME test_cpp_reset COMMAND unit RESET_CPP) | ||
add_test(NAME test_cpp_exception COMMAND unit EXCEPTION_CPP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters