2021-01-02 10:32:20 +01:00
|
|
|
find_package(Threads)
|
2018-03-29 17:34:21 +02:00
|
|
|
|
2021-01-02 10:32:20 +01:00
|
|
|
find_package(Catch2 QUIET)
|
2018-03-29 17:34:21 +02:00
|
|
|
|
2021-06-30 08:30:36 +02:00
|
|
|
if (NOT Catch2_FOUND)
|
2021-01-02 10:32:20 +01:00
|
|
|
include(FetchContent)
|
2018-03-29 17:34:21 +02:00
|
|
|
|
2021-01-02 10:32:20 +01:00
|
|
|
FetchContent_Declare(
|
|
|
|
Catch2
|
|
|
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
2024-03-05 11:56:14 +01:00
|
|
|
GIT_TAG v3.5.3)
|
2018-03-29 17:34:21 +02:00
|
|
|
|
2021-01-02 10:32:20 +01:00
|
|
|
FetchContent_MakeAvailable(Catch2)
|
2019-01-22 23:58:49 +01:00
|
|
|
|
2021-01-02 10:32:20 +01:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/contrib)
|
|
|
|
endif()
|
2018-03-29 17:34:21 +02:00
|
|
|
|
|
|
|
add_executable(
|
|
|
|
unit_tests
|
2019-04-22 23:15:51 +02:00
|
|
|
buffer.cpp
|
2018-04-14 13:03:44 +02:00
|
|
|
message.cpp
|
2018-04-03 12:02:08 +02:00
|
|
|
context.cpp
|
|
|
|
socket.cpp
|
2019-04-07 23:10:04 +02:00
|
|
|
socket_ref.cpp
|
2018-05-11 11:43:41 +02:00
|
|
|
poller.cpp
|
2018-05-11 10:56:41 +02:00
|
|
|
active_poller.cpp
|
2018-05-11 11:01:04 +02:00
|
|
|
multipart.cpp
|
2019-10-26 20:29:22 +02:00
|
|
|
recv_multipart.cpp
|
|
|
|
send_multipart.cpp
|
2020-03-20 10:59:15 +01:00
|
|
|
codec_multipart.cpp
|
2019-05-31 14:09:20 +02:00
|
|
|
monitor.cpp
|
|
|
|
utilities.cpp
|
2018-09-23 18:14:25 +02:00
|
|
|
)
|
2018-03-29 17:34:21 +02:00
|
|
|
|
2019-01-22 23:58:49 +01:00
|
|
|
target_include_directories(unit_tests PUBLIC ${CATCH_MODULE_PATH})
|
2018-03-29 17:34:21 +02:00
|
|
|
target_link_libraries(
|
|
|
|
unit_tests
|
2024-03-05 11:56:14 +01:00
|
|
|
PRIVATE Catch2::Catch2WithMain
|
2018-06-02 18:25:37 +02:00
|
|
|
PRIVATE cppzmq
|
2019-01-22 21:55:06 +01:00
|
|
|
PRIVATE ${CMAKE_THREAD_LIBS_INIT}
|
2018-09-23 18:14:25 +02:00
|
|
|
)
|
2018-03-29 17:34:21 +02:00
|
|
|
|
2018-06-02 18:25:37 +02:00
|
|
|
OPTION (COVERAGE "Enable gcda file generation needed by lcov" OFF)
|
|
|
|
|
|
|
|
if (COVERAGE)
|
|
|
|
target_compile_options(unit_tests PRIVATE --coverage)
|
2021-07-15 15:21:02 +02:00
|
|
|
target_link_options(unit_tests PRIVATE --coverage)
|
|
|
|
message(STATUS "Coverage enabled")
|
2018-06-02 18:25:37 +02:00
|
|
|
endif()
|
|
|
|
|
2021-01-02 10:32:20 +01:00
|
|
|
include(CTest)
|
|
|
|
include(Catch)
|
2019-01-22 23:58:49 +01:00
|
|
|
catch_discover_tests(unit_tests)
|