mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-12 18:40:28 +01:00
6a6aebb845
Solution: Use Threads cmake module as suggested in this thread: https://cmake.org/pipermail/cmake/2016-February/062729.html I was able to reproduce with gcc 8.2.1 and cmake 3.13.2.
48 lines
1.1 KiB
CMake
48 lines
1.1 KiB
CMake
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
|
|
|
project(cppzmq-test CXX)
|
|
|
|
# place binaries and libraries according to GNU standards
|
|
|
|
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})
|
|
|
|
include(cmake/catch.cmake)
|
|
find_package(Threads)
|
|
|
|
add_executable(
|
|
unit_tests
|
|
message.cpp
|
|
context.cpp
|
|
socket.cpp
|
|
poller.cpp
|
|
active_poller.cpp
|
|
multipart.cpp
|
|
monitor.cpp
|
|
)
|
|
|
|
add_dependencies(unit_tests catch)
|
|
|
|
target_include_directories(unit_tests PUBLIC ${CATCH_INCLUDE_DIR})
|
|
target_link_libraries(
|
|
unit_tests
|
|
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)
|
|
target_link_libraries(unit_tests PRIVATE --coverage)
|
|
endif()
|
|
|
|
add_test(
|
|
NAME
|
|
unit
|
|
COMMAND
|
|
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/unit_tests
|
|
)
|