mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-13 10:52:57 +01:00
a5578a6f25
It seems that there is a bug in libzmq 4.2.0 cmake configs that prevents linking to it without installing. Solution: disable libzmq 4.2.0 for cmake builds
45 lines
994 B
CMake
45 lines
994 B
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})
|
|
|
|
# we use this to get code coverage
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
|
endif()
|
|
|
|
include(cmake/googletest.cmake)
|
|
fetch_googletest(
|
|
${PROJECT_SOURCE_DIR}/cmake
|
|
${PROJECT_BINARY_DIR}/googletest
|
|
)
|
|
|
|
add_executable(
|
|
unit_tests
|
|
message.cpp
|
|
context.cpp
|
|
socket.cpp
|
|
poller.cpp
|
|
active_poller.cpp
|
|
multipart.cpp
|
|
)
|
|
|
|
target_link_libraries(
|
|
unit_tests
|
|
gtest_main
|
|
cppzmq
|
|
)
|
|
|
|
add_test(
|
|
NAME
|
|
unit
|
|
COMMAND
|
|
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/unit_tests
|
|
)
|