问题描述
我想使用cppzmq构建应用程序,我正在寻找有关正确管理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)
我执行以下操作
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=staging
我遇到的问题是zmq是cppzmq的依赖项,我不确定如何使用cmake来解决它。
例如,如果我禁用cppzmq内容并运行make install,则将安装zmq,cppzmq将找到它(一旦我重新启用它并重新运行cmake)
预先感谢
布莱恩
解决方法
原来这是我使用的cppzmq版本的一个问题,此版本已在master中修复