2018-03-29 17:34:21 +02:00
|
|
|
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
|
|
|
|
|
|
|
project(cppzmq-test CXX)
|
|
|
|
|
|
|
|
# place binaries and libraries according to GNU standards
|
|
|
|
|
2018-04-02 13:21:11 +02:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})
|
2018-03-29 17:34:21 +02:00
|
|
|
|
|
|
|
include(cmake/googletest.cmake)
|
|
|
|
fetch_googletest(
|
|
|
|
${PROJECT_SOURCE_DIR}/cmake
|
|
|
|
${PROJECT_BINARY_DIR}/googletest
|
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(
|
|
|
|
unit_tests
|
2018-04-14 13:03:44 +02:00
|
|
|
message.cpp
|
2018-04-03 12:02:08 +02:00
|
|
|
context.cpp
|
|
|
|
socket.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
|
2018-06-04 10:41:17 +02:00
|
|
|
monitor.cpp
|
2018-03-29 17:34:21 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(
|
|
|
|
unit_tests
|
2018-06-04 10:41:17 +02:00
|
|
|
PRIVATE gtest
|
|
|
|
PRIVATE gmock_main
|
2018-06-02 18:25:37 +02:00
|
|
|
PRIVATE cppzmq
|
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)
|
|
|
|
target_link_libraries(unit_tests PRIVATE --coverage)
|
|
|
|
endif()
|
|
|
|
|
2018-03-29 17:34:21 +02:00
|
|
|
add_test(
|
|
|
|
NAME
|
|
|
|
unit
|
|
|
|
COMMAND
|
|
|
|
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/unit_tests
|
|
|
|
)
|