Problem: libzmq 4.2.0 cmake build broken

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
This commit is contained in:
Pawel Kurdybacha 2018-05-12 22:02:04 +01:00
parent 3dc20bb05a
commit a5578a6f25
5 changed files with 27 additions and 21 deletions

View File

@ -17,13 +17,13 @@ addons:
env: env:
matrix: matrix:
# - BUILD_TYPE=cmake DRAFT=enabled # - ZMQ_BUILD_TYPE=cmake DRAFT=enabled
- BUILD_TYPE=cmake ZMQ_VERSION=4.2.5 - ZMQ_BUILD_TYPE=cmake ZMQ_VERSION=4.2.5
- BUILD_TYPE=cmake ZMQ_VERSION=4.2.0 - ZMQ_BUILD_TYPE=pkgconf ZMQ_VERSION=4.2.0
matrix: matrix:
include: 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 # os: linux
# addons: # addons:
# apt: # apt:
@ -39,15 +39,15 @@ matrix:
packages: packages:
- g++-7 - g++-7
env: 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 sudo: required
before_install: before_install:
- pip install --user cpp-coveralls - pip install --user cpp-coveralls
# Build and check this project according to the BUILD_TYPE # Build and check this project according to the ZMQ_BUILD_TYPE
script: script:
- eval "${MATRIX_EVAL}" - eval "${MATRIX_EVAL}"
- ./ci_build.sh - ./ci_build.sh

View File

@ -71,7 +71,6 @@ cpp zmq (which will also include libzmq for you).
#find cppzmq wrapper, installed by make of cppzmq #find cppzmq wrapper, installed by make of cppzmq
find_package(cppzmq) find_package(cppzmq)
if(cppzmq_FOUND) if(cppzmq_FOUND)
include_directories(${ZeroMQ_INCLUDE_DIR} ${cppzmq_INCLUDE_DIR})
target_link_libraries(*Your Project Name* ${cppzmq_LIBRARY}) target_link_libraries(*Your Project Name* ${cppzmq_LIBRARY})
endif() endif()
``` ```

View File

@ -16,11 +16,23 @@ install_zeromq() {
curl -L https://github.com/zeromq/libzmq/archive/v${ZMQ_VERSION}.tar.gz \ curl -L https://github.com/zeromq/libzmq/archive/v${ZMQ_VERSION}.tar.gz \
>zeromq.tar.gz >zeromq.tar.gz
tar -xvzf zeromq.tar.gz tar -xvzf zeromq.tar.gz
cmake -Hlibzmq-${ZMQ_VERSION} -B${LIBZMQ} -DWITH_PERF_TOOL=OFF \ if [ "${ZMQ_BUILD_TYPE}" = "cmake" ] ; then
-DZMQ_BUILD_TESTS=OFF \ cmake -Hlibzmq-${ZMQ_VERSION} -B${LIBZMQ} -DWITH_PERF_TOOL=OFF \
-DCMAKE_BUILD_TYPE=Release \ -DZMQ_BUILD_TESTS=OFF \
${ZEROMQ_CMAKE_FLAGS} -DCMAKE_BUILD_TYPE=Release \
cmake --build ${LIBZMQ} ${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 # build zeromq first
@ -28,6 +40,7 @@ install_zeromq() {
if [ "${ZMQ_VERSION}" != "" ] ; then install_zeromq ; fi if [ "${ZMQ_VERSION}" != "" ] ; then install_zeromq ; fi
# build cppzmq # build cppzmq
# for pkgconf ZMQ_BUILD_TYPE ZeroMQ_DIR is invalid but it should still work
pushd . pushd .
ZeroMQ_DIR=${LIBZMQ} cmake -H. -B${CPPZMQ} ${ZEROMQ_CMAKE_FLAGS} ZeroMQ_DIR=${LIBZMQ} cmake -H. -B${CPPZMQ} ${ZEROMQ_CMAKE_FLAGS}
cmake --build ${CPPZMQ} cmake --build ${CPPZMQ}

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(cppzmq-demo CXX) project(cppzmq-demo CXX)
find_package(cppzmq REQUIRED) find_package(cppzmq)
enable_testing() enable_testing()
add_executable( add_executable(
@ -15,9 +15,6 @@ target_link_libraries(
cppzmq cppzmq
) )
target_include_directories(demo PRIVATE ${cppzmq_INCLUDE_DIR}
${ZeroMQ_INCLUDE_DIR})
add_test( add_test(
NAME NAME
demo demo

View File

@ -36,9 +36,6 @@ target_link_libraries(
cppzmq cppzmq
) )
target_include_directories(unit_tests PRIVATE ${cppzmq_INCLUDE_DIR}
${ZeroMQ_INCLUDE_DIR})
add_test( add_test(
NAME NAME
unit unit