2018-12-23 16:38:00 -05:00
|
|
|
include(CTest)
|
|
|
|
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/src)
|
|
|
|
include_directories(${CMAKE_BINARY_DIR})
|
|
|
|
include_directories(${conky_includes})
|
|
|
|
|
2024-12-09 02:26:32 +00:00
|
|
|
file(GLOB test_srcs test-*.cc)
|
2018-12-23 16:38:00 -05:00
|
|
|
|
2024-12-09 02:26:32 +00:00
|
|
|
if(NOT OS_LINUX)
|
|
|
|
list(FILTER test_srcs EXCLUDE REGEX ".*linux.*\.cc?")
|
2018-12-23 16:38:00 -05:00
|
|
|
endif()
|
|
|
|
|
2024-12-09 02:26:32 +00:00
|
|
|
if(NOT OS_DARWIN)
|
|
|
|
list(FILTER test_srcs EXCLUDE REGEX ".*darwin.*\.cc?")
|
2018-12-23 16:38:00 -05:00
|
|
|
endif()
|
|
|
|
|
2024-12-09 02:26:32 +00:00
|
|
|
add_library(Catch2 STATIC catch2/catch_amalgamated.cpp)
|
2019-06-20 12:51:39 -07:00
|
|
|
|
2018-12-23 16:38:00 -05:00
|
|
|
add_executable(test-conky test-common.cc ${test_srcs})
|
2024-12-09 02:26:32 +00:00
|
|
|
target_link_libraries(test-conky
|
|
|
|
PRIVATE Catch2
|
|
|
|
PUBLIC conky_core
|
|
|
|
)
|
2018-12-28 13:26:29 -05:00
|
|
|
catch_discover_tests(test-conky)
|
2018-12-23 16:38:00 -05:00
|
|
|
|
2025-01-05 06:37:03 +01:00
|
|
|
if(RUN_TESTS)
|
|
|
|
add_custom_command(TARGET test-conky
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND ctest -C $<CONFIGURATION> --output-on-failure)
|
|
|
|
endif()
|
|
|
|
|
2022-12-26 11:46:29 -05:00
|
|
|
if(CODE_COVERAGE)
|
2018-12-23 16:38:00 -05:00
|
|
|
set(COVERAGE_LCOV_EXCLUDES
|
2024-10-30 08:29:15 -04:00
|
|
|
"*/include/c++/v1/*"
|
|
|
|
"/usr/include/*"
|
|
|
|
"/usr/lib/*"
|
|
|
|
"/usr/local/Cellar/*"
|
|
|
|
"/usr/local/include/*"
|
|
|
|
"/usr/local/lib/*"
|
|
|
|
"/usr/include/libkern/i386/*"
|
|
|
|
"/usr/include/sys/_types/*"
|
|
|
|
"/usr/local/opt/gettext/include/*"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/*"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/catch2/*"
|
|
|
|
"${CMAKE_SOURCE_DIR}/3rdparty/*")
|
2018-12-23 16:38:00 -05:00
|
|
|
|
|
|
|
setup_target_for_coverage_lcov_html(NAME
|
2024-10-30 08:29:15 -04:00
|
|
|
test-conky-coverage-html
|
|
|
|
EXECUTABLE
|
|
|
|
test-conky
|
|
|
|
DEPENDENCIES
|
|
|
|
test-conky)
|
2018-12-23 16:38:00 -05:00
|
|
|
setup_target_for_coverage_lcov_txt(NAME
|
2024-10-30 08:29:15 -04:00
|
|
|
test-conky-coverage-txt
|
|
|
|
EXECUTABLE
|
|
|
|
test-conky
|
|
|
|
DEPENDENCIES
|
|
|
|
test-conky)
|
2018-12-23 16:38:00 -05:00
|
|
|
endif()
|