Skip to content

Commit

Permalink
Problem: libzmq 4.2.0 cmake build broken
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kurdybacha committed May 13, 2018
1 parent 3dc20bb commit a5578a6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 21 deletions.
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ addons:

env:
matrix:
# - BUILD_TYPE=cmake DRAFT=enabled
- BUILD_TYPE=cmake ZMQ_VERSION=4.2.5
- BUILD_TYPE=cmake ZMQ_VERSION=4.2.0
# - ZMQ_BUILD_TYPE=cmake DRAFT=enabled
- ZMQ_BUILD_TYPE=cmake ZMQ_VERSION=4.2.5
- ZMQ_BUILD_TYPE=pkgconf ZMQ_VERSION=4.2.0

matrix:
include:
# - env: BUILD_TYPE=cmake DO_CLANG_FORMAT_CHECK=1 CLANG_FORMAT=/usr/local/clang-5.0.0/bin/clang-format
# - env: ZMQ_BUILD_TYPE=cmake DO_CLANG_FORMAT_CHECK=1 CLANG_FORMAT=/usr/local/clang-5.0.0/bin/clang-format
# os: linux
# addons:
# apt:
Expand All @@ -39,15 +39,15 @@ matrix:
packages:
- g++-7
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" BUILD_TYPE=cmake ZMQ_VERSION=4.2.5 DRAFT=1
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" ZMQ_BUILD_TYPE=cmake ZMQ_VERSION=4.2.5 DRAFT=1

sudo: required

before_install:
- pip install --user cpp-coveralls
# Build and check this project according to the BUILD_TYPE
script:

# Build and check this project according to the ZMQ_BUILD_TYPE
script:
- eval "${MATRIX_EVAL}"
- ./ci_build.sh

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ cpp zmq (which will also include libzmq for you).
#find cppzmq wrapper, installed by make of cppzmq
find_package(cppzmq)
if(cppzmq_FOUND)
include_directories(${ZeroMQ_INCLUDE_DIR} ${cppzmq_INCLUDE_DIR})
target_link_libraries(*Your Project Name* ${cppzmq_LIBRARY})
endif()
```
Expand Down
23 changes: 18 additions & 5 deletions ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,31 @@ install_zeromq() {
curl -L https://github.com/zeromq/libzmq/archive/v${ZMQ_VERSION}.tar.gz \
>zeromq.tar.gz
tar -xvzf zeromq.tar.gz
cmake -Hlibzmq-${ZMQ_VERSION} -B${LIBZMQ} -DWITH_PERF_TOOL=OFF \
-DZMQ_BUILD_TESTS=OFF \
-DCMAKE_BUILD_TYPE=Release \
${ZEROMQ_CMAKE_FLAGS}
cmake --build ${LIBZMQ}
if [ "${ZMQ_BUILD_TYPE}" = "cmake" ] ; then
cmake -Hlibzmq-${ZMQ_VERSION} -B${LIBZMQ} -DWITH_PERF_TOOL=OFF \
-DZMQ_BUILD_TESTS=OFF \
-DCMAKE_BUILD_TYPE=Release \
${ZEROMQ_CMAKE_FLAGS}
cmake --build ${LIBZMQ}
elif [ "${ZMQ_BUILD_TYPE}" = "pkgconf" ] ; then
pushd .
cd libzmq-${ZMQ_VERSION}
./autogen.sh
./configure
sudo make VERBOSE=1 -j5 install
popd
else
echo "Unsupported build type ${ZMQ_BUILD_TYPE}."
exit 1
fi
}

# build zeromq first

if [ "${ZMQ_VERSION}" != "" ] ; then install_zeromq ; fi

# build cppzmq
# for pkgconf ZMQ_BUILD_TYPE ZeroMQ_DIR is invalid but it should still work
pushd .
ZeroMQ_DIR=${LIBZMQ} cmake -H. -B${CPPZMQ} ${ZEROMQ_CMAKE_FLAGS}
cmake --build ${CPPZMQ}
Expand Down
5 changes: 1 addition & 4 deletions demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

project(cppzmq-demo CXX)

find_package(cppzmq REQUIRED)
find_package(cppzmq)

enable_testing()
add_executable(
Expand All @@ -15,9 +15,6 @@ target_link_libraries(
cppzmq
)

target_include_directories(demo PRIVATE ${cppzmq_INCLUDE_DIR}
${ZeroMQ_INCLUDE_DIR})

add_test(
NAME
demo
Expand Down
3 changes: 0 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ target_link_libraries(
cppzmq
)

target_include_directories(unit_tests PRIVATE ${cppzmq_INCLUDE_DIR}
${ZeroMQ_INCLUDE_DIR})

add_test(
NAME
unit
Expand Down

0 comments on commit a5578a6

Please sign in to comment.