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
|
|
|
|
|
|
|
# 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
|
|
|
|
example_add.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(
|
|
|
|
unit_tests
|
|
|
|
gtest_main
|
2018-03-29 18:14:34 +02:00
|
|
|
libzmq
|
2018-03-29 17:34:21 +02:00
|
|
|
)
|
|
|
|
|
2018-04-02 13:21:11 +02:00
|
|
|
target_include_directories(unit_tests PRIVATE ..)
|
|
|
|
|
2018-03-29 17:34:21 +02:00
|
|
|
add_test(
|
|
|
|
NAME
|
|
|
|
unit
|
|
|
|
COMMAND
|
|
|
|
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/unit_tests
|
|
|
|
)
|