mirror of
https://github.com/zeromq/cppzmq.git
synced 2024-12-12 10:33:52 +01:00
Problem: code coverage not working
Solution: build tests within cppzmq build, and add separate demo
This commit is contained in:
parent
b737b9f1de
commit
63f81e40d6
@ -41,4 +41,4 @@ script:
|
||||
- ./ci_build.sh
|
||||
|
||||
after_success:
|
||||
- coveralls --root . -E ".*external.*" -E ".*CMakeFiles.*" -E ".*tests/" -E ".*libzmq/"
|
||||
- coveralls --root . -E ".*external.*" -E ".*CMakeFiles.*" -E ".*tests/" -E ".*demo/" -E ".*libzmq/"
|
||||
|
@ -63,3 +63,6 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
|
||||
DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/libzmq-pkg-config/FindZeroMQ.cmake
|
||||
DESTINATION ${CPPZMQ_CMAKECONFIG_INSTALL_DIR}/libzmq-pkg-config)
|
||||
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
|
@ -29,11 +29,13 @@ pushd .
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --build .
|
||||
sudo make -j4 install
|
||||
make test ARGS="-V"
|
||||
popd
|
||||
|
||||
# build cppzmq tests
|
||||
cd tests
|
||||
# build cppzmq demo
|
||||
cd demo
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
|
23
demo/CMakeLists.txt
Normal file
23
demo/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
||||
|
||||
project(cppzmq-demo CXX)
|
||||
|
||||
find_package(cppzmq)
|
||||
|
||||
enable_testing()
|
||||
add_executable(
|
||||
demo
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
demo
|
||||
libzmq
|
||||
)
|
||||
|
||||
add_test(
|
||||
NAME
|
||||
demo
|
||||
COMMAND
|
||||
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/demo
|
||||
)
|
8
demo/main.cpp
Normal file
8
demo/main.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include <zmq.hpp>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
zmq::context_t context;
|
||||
|
||||
return 0;
|
||||
}
|
@ -3,12 +3,11 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
||||
project(cppzmq-test CXX)
|
||||
|
||||
# place binaries and libraries according to GNU standards
|
||||
# TODO check if we should do this
|
||||
|
||||
# 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(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)
|
||||
@ -20,10 +19,6 @@ fetch_googletest(
|
||||
${PROJECT_SOURCE_DIR}/cmake
|
||||
${PROJECT_BINARY_DIR}/googletest
|
||||
)
|
||||
|
||||
find_package(cppzmq)
|
||||
|
||||
enable_testing()
|
||||
|
||||
add_executable(
|
||||
unit_tests
|
||||
@ -36,6 +31,8 @@ target_link_libraries(
|
||||
libzmq
|
||||
)
|
||||
|
||||
target_include_directories(unit_tests PRIVATE ..)
|
||||
|
||||
add_test(
|
||||
NAME
|
||||
unit
|
||||
|
Loading…
Reference in New Issue
Block a user