Skip to content

Commit f35cbe2

Browse files
committed
Problem: libzmq installed during build
There is no need to install libzmq into the system. Out of source build can be used later to build cppzmq. Solution: remove install steps and rely more on cmake to handle directory creation.
1 parent f81accd commit f35cbe2

File tree

2 files changed

+16
-28
lines changed

2 files changed

+16
-28
lines changed

ci_build.sh

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,34 @@ set -x
44
set -e
55

66
if [ "$DRAFT" = "1" ] ; then
7-
# if we enable drafts during the libzmq cmake build, the pkgconfig
8-
# data should set ZMQ_BUILD_DRAFT_API in dependent builds, but this
7+
# if we enable drafts during the libzmq cmake build, the pkgconfig
8+
# data should set ZMQ_BUILD_DRAFT_API in dependent builds, but this
99
# does not appear to work (TODO)
1010
export ZEROMQ_CMAKE_FLAGS="-DENABLE_DRAFTS=ON"
1111
fi
1212

1313
install_zeromq() {
14-
pushd .
15-
16-
mkdir libzmq
17-
cd libzmq
18-
curl -L https://github.com/zeromq/libzmq/archive/v${ZMQ_VERSION}.tar.gz >zeromq.tar.gz
14+
curl -L https://github.com/zeromq/libzmq/archive/v${ZMQ_VERSION}.tar.gz \
15+
>zeromq.tar.gz
1916
tar -xvzf zeromq.tar.gz
20-
cd libzmq-${ZMQ_VERSION}
21-
22-
mkdir build
23-
cd build
24-
cmake .. ${ZEROMQ_CMAKE_FLAGS}
25-
sudo make -j4 install
26-
27-
popd
17+
cmake -Hlibzmq-${ZMQ_VERSION} -Blibzmq ${ZEROMQ_CMAKE_FLAGS}
18+
cmake --build libzmq
2819
}
2920

3021
# build zeromq first
3122

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

3425
# build cppzmq
35-
3626
pushd .
37-
mkdir build
27+
ZeroMQ_DIR=libzmq cmake -H. -Bbuild ${ZEROMQ_CMAKE_FLAGS}
28+
cmake --build build
3829
cd build
39-
cmake .. ${ZEROMQ_CMAKE_FLAGS}
40-
cmake --build .
41-
sudo make -j4 install
42-
make test ARGS="-V"
30+
ctest -V
4331
popd
4432

4533
# build cppzmq demo
46-
cd demo
47-
mkdir build
48-
cd build
49-
cmake ..
50-
cmake --build .
34+
ZeroMQ_DIR=libzmq cppzmq_DIR=build cmake -Hdemo -Bdemo/build
35+
cmake --build demo/build
36+
cd demo/build
5137
ctest

demo/CMakeLists.txt

Lines changed: 4 additions & 2 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)
5+
find_package(cppzmq REQUIRED)
66

77
enable_testing()
88
add_executable(
@@ -12,9 +12,11 @@ add_executable(
1212

1313
target_link_libraries(
1414
demo
15-
libzmq
15+
cppzmq
1616
)
1717

18+
include_directories(${ZeroMQ_INCLUDE_DIR} ${cppzmq_INCLUDE_DIR})
19+
1820
add_test(
1921
NAME
2022
demo

0 commit comments

Comments
 (0)