brian
brian

Reputation: 93

Is it possible to use cmake FetchContent with install dependencies

I want to build an application using cppzmq and i'm looking for advice to properly managing dependencies in cmake.

cmake_minimum_required(VERSION 3.16)

project(myTest)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED true)

include(FetchContent)

FetchContent_Declare(
    zmq
    GIT_REPOSITORY https://github.com/zeromq/libzmq.git
    GIT_TAG        v4.3.2
)
FetchContent_MakeAvailable(zmq)

FetchContent_Declare(
    cppzmq
    GIT_REPOSITORY https://github.com/zeromq/cppzmq.git
    GIT_TAG        v4.6.0
)
FetchContent_MakeAvailable(cppzmq)

I execute with the following

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=staging

The problem I am having is that zmq is a dependency of cppzmq and i'm not sure how to resolve it using cmake.

For example if i disable the cppzmq content and run make install, zmq will be installed and cppzmq will find it (once i re-enable it and rerun cmake)

Thanks in advance

Brian

Upvotes: 2

Views: 2588

Answers (1)

brian
brian

Reputation: 93

Turns out this is an issue with the version of cppzmq i was using and has since been fixed in master

https://github.com/zeromq/cppzmq/issues/436

Upvotes: 4

Related Questions