A T*_*A T 9 c++ deployment dependencies package-managers
我一直在研究各种开源项目,涉及以下C++库(及其他):
在干净的机器上设置这些库时,通常需要很长时间才能配置这些库.有没有办法自动获取Windows机器上的所有依赖项?
我发现的最接近的是CMake,它会检查以确保在生成项目文件之前安装/提取了依赖项.但我没有找到任何可以解析依赖项列表的Windows,然后下载+安装所需的版本.
请推荐一个带有最新C++库的Windows软件包管理器.
当您已经使用 CMake 设置项目时,请查看Hunter 包管理器。它会自动下载并构建您的依赖项,只需几行额外的 cmake 代码。Hunter 基于 cmake 导出和导入目标。
例如,如果您想在基于 cmake 的项目中使用 GoogleTest 库,您可以将以下行添加到根 CMakeLists.txt
# file root CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
# To get hunter you need to download and include a single cmake file
# see documentation for correct name
include("../gate.cmake")
project(download-gtest)
# set the location of all your hunter-packages
set( HUNTER_ROOT_DIR C:/CppLibraries/HunterLibraries )
# This call automaticall downloads and compiles gtest the first time
# cmake is executed. The library is then cached in the HUNTER_ROOT_DIR
hunter_add_package(GTest)
# Now the GTest library can be found and linked to by your own project
find_package(GTest CONFIG REQUIRED)
add_executable(foo foo.cpp)
target_link_libraries(foo GTest::main)
Run Code Online (Sandbox Code Playgroud)
并非您列出的所有库都可以作为“猎人包”使用,但该项目是开源的,因此您可以为您的依赖项创建猎人包并将它们提交到项目中。以下是已经作为 Hunter 包提供的库的列表。
这并不能立即解决您的所有问题,因为您必须为您的依赖项创建猎人包。但现有的框架已经做了很多工作,最好使用它,而不是半途而废的自制解决方案。
| 归档时间: |
|
| 查看次数: |
3096 次 |
| 最近记录: |