Skip to content

Commit a5578a6

Browse files
committed
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
1 parent 3dc20bb commit a5578a6

File tree

5 files changed

+27
-21
lines changed

5 files changed

+27
-21
lines changed

.travis.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ addons:
1717

1818
env:
1919
matrix:
20-
# - BUILD_TYPE=cmake DRAFT=enabled
21-
- BUILD_TYPE=cmake ZMQ_VERSION=4.2.5
22-
- BUILD_TYPE=cmake ZMQ_VERSION=4.2.0
20+
# - ZMQ_BUILD_TYPE=cmake DRAFT=enabled
21+
- ZMQ_BUILD_TYPE=cmake ZMQ_VERSION=4.2.5
22+
- ZMQ_BUILD_TYPE=pkgconf ZMQ_VERSION=4.2.0
2323

2424
matrix:
2525
include:
26-
# - env: BUILD_TYPE=cmake DO_CLANG_FORMAT_CHECK=1 CLANG_FORMAT=/usr/local/clang-5.0.0/bin/clang-format
26+
# - env: ZMQ_BUILD_TYPE=cmake DO_CLANG_FORMAT_CHECK=1 CLANG_FORMAT=/usr/local/clang-5.0.0/bin/clang-format
2727
# os: linux
2828
# addons:
2929
# apt:
@@ -39,15 +39,15 @@ matrix:
3939
packages:
4040
- g++-7
4141
env:
42-
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" BUILD_TYPE=cmake ZMQ_VERSION=4.2.5 DRAFT=1
42+
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" ZMQ_BUILD_TYPE=cmake ZMQ_VERSION=4.2.5 DRAFT=1
4343

4444
sudo: required
4545

4646
before_install:
4747
- pip install --user cpp-coveralls
48-
49-
# Build and check this project according to the BUILD_TYPE
50-
script:
48+
49+
# Build and check this project according to the ZMQ_BUILD_TYPE
50+
script:
5151
- eval "${MATRIX_EVAL}"
5252
- ./ci_build.sh
5353

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ cpp zmq (which will also include libzmq for you).
7171
#find cppzmq wrapper, installed by make of cppzmq
7272
find_package(cppzmq)
7373
if(cppzmq_FOUND)
74-
include_directories(${ZeroMQ_INCLUDE_DIR} ${cppzmq_INCLUDE_DIR})
7574
target_link_libraries(*Your Project Name* ${cppzmq_LIBRARY})
7675
endif()
7776
```

ci_build.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,31 @@ install_zeromq() {
1616
curl -L https://github.com/zeromq/libzmq/archive/v${ZMQ_VERSION}.tar.gz \
1717
>zeromq.tar.gz
1818
tar -xvzf zeromq.tar.gz
19-
cmake -Hlibzmq-${ZMQ_VERSION} -B${LIBZMQ} -DWITH_PERF_TOOL=OFF \
20-
-DZMQ_BUILD_TESTS=OFF \
21-
-DCMAKE_BUILD_TYPE=Release \
22-
${ZEROMQ_CMAKE_FLAGS}
23-
cmake --build ${LIBZMQ}
19+
if [ "${ZMQ_BUILD_TYPE}" = "cmake" ] ; then
20+
cmake -Hlibzmq-${ZMQ_VERSION} -B${LIBZMQ} -DWITH_PERF_TOOL=OFF \
21+
-DZMQ_BUILD_TESTS=OFF \
22+
-DCMAKE_BUILD_TYPE=Release \
23+
${ZEROMQ_CMAKE_FLAGS}
24+
cmake --build ${LIBZMQ}
25+
elif [ "${ZMQ_BUILD_TYPE}" = "pkgconf" ] ; then
26+
pushd .
27+
cd libzmq-${ZMQ_VERSION}
28+
./autogen.sh
29+
./configure
30+
sudo make VERBOSE=1 -j5 install
31+
popd
32+
else
33+
echo "Unsupported build type ${ZMQ_BUILD_TYPE}."
34+
exit 1
35+
fi
2436
}
2537

2638
# build zeromq first
2739

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

3042
# build cppzmq
43+
# for pkgconf ZMQ_BUILD_TYPE ZeroMQ_DIR is invalid but it should still work
3144
pushd .
3245
ZeroMQ_DIR=${LIBZMQ} cmake -H. -B${CPPZMQ} ${ZEROMQ_CMAKE_FLAGS}
3346
cmake --build ${CPPZMQ}

demo/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
22

33
project(cppzmq-demo CXX)
44

5-
find_package(cppzmq REQUIRED)
5+
find_package(cppzmq)
66

77
enable_testing()
88
add_executable(
@@ -15,9 +15,6 @@ target_link_libraries(
1515
cppzmq
1616
)
1717

18-
target_include_directories(demo PRIVATE ${cppzmq_INCLUDE_DIR}
19-
${ZeroMQ_INCLUDE_DIR})
20-
2118
add_test(
2219
NAME
2320
demo

tests/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ target_link_libraries(
3636
cppzmq
3737
)
3838

39-
target_include_directories(unit_tests PRIVATE ${cppzmq_INCLUDE_DIR}
40-
${ZeroMQ_INCLUDE_DIR})
41-
4239
add_test(
4340
NAME
4441
unit

0 commit comments

Comments
 (0)