cppzmq/tests/CMakeLists.txt

54 lines
1.1 KiB
CMake
Raw Normal View History

2021-01-02 10:32:20 +01:00
find_package(Threads)
2021-01-02 10:32:20 +01:00
find_package(Catch2 QUIET)
2021-06-30 08:30:36 +02:00
if (NOT Catch2_FOUND)
2021-01-02 10:32:20 +01:00
include(FetchContent)
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)
2021-01-02 10:32:20 +01:00
FetchContent_MakeAvailable(Catch2)
2021-01-02 10:32:20 +01:00
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/contrib)
endif()
add_executable(
unit_tests
buffer.cpp
message.cpp
context.cpp
socket.cpp
socket_ref.cpp
poller.cpp
active_poller.cpp
multipart.cpp
recv_multipart.cpp
send_multipart.cpp
codec_multipart.cpp
monitor.cpp
utilities.cpp
)
target_include_directories(unit_tests PUBLIC ${CATCH_MODULE_PATH})
target_link_libraries(
unit_tests
2024-03-05 11:56:14 +01:00
PRIVATE Catch2::Catch2WithMain
PRIVATE cppzmq
PRIVATE ${CMAKE_THREAD_LIBS_INIT}
)
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")
endif()
2021-01-02 10:32:20 +01:00
include(CTest)
include(Catch)
catch_discover_tests(unit_tests)