zeromq / cppzmq

Header-only C++ binding for libzmq
http://www.zeromq.org
MIT License
1.93k stars 757 forks source link

Cannot be build without Git #554

Open questaware opened 2 years ago

questaware commented 2 years ago

It is possible to download the code as a zip file but the build process relies on the code being in a local repo.

The instructions should at least include how to set up that local repo.

Better the build process should do it itself.

This is important because many people work in secure environments which prevent cloning.

muxator commented 1 year ago

I am just a user of this library, but maybe I can help you. The library itself is header only: in order to use it, you just need zmq.hpp and (if you want it) zmq_addon.hpp. You could just copy thos files in your source tree.

The tests, however, need to be built. For those there may be come catches, see later. Are you sure you need to build the test suite?

However, from a quick glance, the test suite is based on catch2 library. The CMake scripts use the system's version, or try to download them hitting the network (and using git for that).

On Fedora, running dnf install catch2-devel is enough to build the tests in network-less system.

Example:

Prepare a bare Fedora 38 container:

docker run -ti --name cppzmq_test fedora:38
dnf install -y cmake g++ zeromq-devel catch2-devel
curl --location https://github.com/zeromq/cppzmq/tarball/945d60c --output cppzmq.tgz
tar xf cppzmq.tgz 
exit

Disconnect the container and do a default build (including tests, which you probably do not need):

docker network disconnect bridge cppzmq_test
docker start -i cppzmq_test
cd zeromq-cppzmq-945d60c
mkdir build
cd build
cmake ..
make -j

Alternatively, you could simply disable building the tests via -DCPPZMQ_BUILD_TESTS=OFF but then why build at all?