Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cmake 柯南和科马克:目标已经存在_Cmake_Hdf5_Conan - Fatal编程技术网

Cmake 柯南和科马克:目标已经存在

Cmake 柯南和科马克:目标已经存在,cmake,hdf5,conan,Cmake,Hdf5,Conan,我使用conan_cmake_run()宏来实现cmake。当我添加两个具有相同外部dep的lib时,会产生一条错误消息 例如: conan_cmake_run(REQUIRES boost/1.74.0 BASIC_SETUP CMAKE_TARGETS) conan_cmake_run(REQUIRES hdf5/1.10.6 BASIC_SETUP CMAKE_TARGETS) Boost和HDF5将添加zlib作为外部dep。因此,在CMake配置期间会出现以下错误消息 CMake

我使用conan_cmake_run()宏来实现cmake。当我添加两个具有相同外部dep的lib时,会产生一条错误消息

例如:

conan_cmake_run(REQUIRES boost/1.74.0 BASIC_SETUP CMAKE_TARGETS)
conan_cmake_run(REQUIRES hdf5/1.10.6  BASIC_SETUP CMAKE_TARGETS)
Boost和HDF5将添加zlib作为外部dep。因此,在CMake配置期间会出现以下错误消息

CMake Error at build/conanbuildinfo_multi.cmake:152 (add_library):
  add_library cannot create imported target "CONAN_PKG::zlib" because another
  target with the same name already exists.
Call Stack (most recent call first):
  build/conanbuildinfo_multi.cmake:286 (conan_define_targets)
  cmake/modules/conan.cmake:515 (conan_basic_setup)
  CMakeLists.txt:104 (conan_cmake_run)
有没有办法明确地不为boost/1.74.0或hdf5/1.10.6添加“CONAN_PKG::zlib”

提前多谢


最好,

非常重要的一点是不要运行两次
cmake\u conan\u run
,而只运行一次多个参数,例如:

conan_cmake_run(REQUIRES boost/1.74.0 hdf5/1.10.6 BASIC_SETUP CMAKE_TARGETS)
进行单独运行时,第二次运行将覆盖上一次运行的结果。此外,在安装过程中,可能会出现一些未被注意到的冲突(如boost/1.74(取决于zlib/1.2.8)和hdf5/1.10.6(取决于zlib/1.2.11)。安装项目的依赖项时,应执行单个
conan安装
,或单个
conan\u cmake\u run()