diff --git a/ci_build.sh b/ci_build.sh index 2b655a2..220ad52 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -4,27 +4,18 @@ set -x set -e if [ "$DRAFT" = "1" ] ; then - # if we enable drafts during the libzmq cmake build, the pkgconfig - # data should set ZMQ_BUILD_DRAFT_API in dependent builds, but this + # if we enable drafts during the libzmq cmake build, the pkgconfig + # data should set ZMQ_BUILD_DRAFT_API in dependent builds, but this # does not appear to work (TODO) export ZEROMQ_CMAKE_FLAGS="-DENABLE_DRAFTS=ON" fi install_zeromq() { - pushd . - - mkdir libzmq - cd libzmq - curl -L https://github.com/zeromq/libzmq/archive/v${ZMQ_VERSION}.tar.gz >zeromq.tar.gz + curl -L https://github.com/zeromq/libzmq/archive/v${ZMQ_VERSION}.tar.gz \ + >zeromq.tar.gz tar -xvzf zeromq.tar.gz - cd libzmq-${ZMQ_VERSION} - - mkdir build - cd build - cmake .. ${ZEROMQ_CMAKE_FLAGS} - sudo make -j4 install - - popd + cmake -Hlibzmq-${ZMQ_VERSION} -Blibzmq ${ZEROMQ_CMAKE_FLAGS} + cmake --build libzmq } # build zeromq first @@ -32,20 +23,15 @@ install_zeromq() { if [ "${ZMQ_VERSION}" != "" ] ; then install_zeromq ; fi # build cppzmq - pushd . -mkdir build +ZeroMQ_DIR=libzmq cmake -H. -Bbuild ${ZEROMQ_CMAKE_FLAGS} +cmake --build build cd build -cmake .. ${ZEROMQ_CMAKE_FLAGS} -cmake --build . -sudo make -j4 install -make test ARGS="-V" +ctest -V popd # build cppzmq demo -cd demo -mkdir build -cd build -cmake .. -cmake --build . +ZeroMQ_DIR=libzmq cppzmq_DIR=build cmake -Hdemo -Bdemo/build +cmake --build demo/build +cd demo/build ctest diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index fc17a2f..a79d84e 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR) project(cppzmq-demo CXX) -find_package(cppzmq) +find_package(cppzmq REQUIRED) enable_testing() add_executable( @@ -12,9 +12,11 @@ add_executable( target_link_libraries( demo - libzmq + cppzmq ) +include_directories(${ZeroMQ_INCLUDE_DIR} ${cppzmq_INCLUDE_DIR}) + add_test( NAME demo