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.
This commit is contained in:
Pawel Kurdybacha 2018-05-12 18:27:42 +01:00
parent f81accd6b1
commit f35cbe2930
2 changed files with 16 additions and 28 deletions

View File

@ -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

View File

@ -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