C++ 如何向CMake提供vcpkg信息?
假设我安装了一些带有C++ 如何向CMake提供vcpkg信息?,c++,cmake,vcpkg,C++,Cmake,Vcpkg,假设我安装了一些带有vcpkg的库,并且它有许多依赖项(比如cgal)。现在我想用CMake针对这些库编译一些程序 我应该如何告诉CMake我下载的所有库的所有位置?包括我安装的主库?在CMake中,我只有一个名为“源目录”的设置,它将指向我的代码。图书馆的设置在哪里 通常你需要设置CMAKE_工具链_文件和VCPKG_目标_三元组 将vcpgg\u TARGET\u三元组设置为您正在使用的vcpgg三元组。默认值为x86 windows 将CMAKE\u工具链\u文件设置为指向\u vcpk
vcpkg
的库,并且它有许多依赖项(比如cgal
)。现在我想用CMake
针对这些库编译一些程序
我应该如何告诉CMake
我下载的所有库的所有位置?包括我安装的主库?在CMake
中,我只有一个名为“源目录”的设置,它将指向我的代码。图书馆的设置在哪里
通常你需要设置<代码>CMAKE_工具链_文件和
VCPKG_目标_三元组
将vcpgg\u TARGET\u三元组设置为您正在使用的vcpgg三元组。默认值为x86 windows
将CMAKE\u工具链\u文件
设置为指向\u vcpkg\scripts\buildsystems\vcpkg.CMAKE的path\u
然后,您可以使用cmake函数(如find_package
)来查找所需的包
有关更多信息,请参阅。设置CMAKE\u工具链\u文件”是什么意思?这是否意味着在外壳中使用set?这是否意味着在CMakeLists.txt中添加一行设置?这是否意味着使用-DCMAKE。。。在cmake命令行上?@sigfpe将其用作-DCMAKE_TOOLCHAIN_FILE=path_to_vcpkg\scripts\buildsystems\vcpkg.cmake我不确定是否有其他方法,但这一种有效,请确保首先执行“vcpkg集成安装”。
D:\Users\ThirdPartyDesign\CGAL-5.0-examples\CGAL-5.0\examples\Triangulation_2
λ env | grep CMAKE
CMAKE_TOOLCHAIN_FILE=D:\Users\ThirdPartyDesign\vcpkg\scripts\buildsystems\vcpkg.cmake
D:\Users\ThirdPartyDesign\CGAL-5.0-examples\CGAL-5.0\examples\Triangulation_2
λ cmake .
CMake Warning at CMakeLists.txt:18 (find_package):
By not providing "FindCGAL.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "CGAL", but
CMake did not find one.
Could not find a package configuration file provided by "CGAL" with any of
the following names:
CGALConfig.cmake
cgal-config.cmake
Add the installation prefix of "CGAL" to CMAKE_PREFIX_PATH or set
"CGAL_DIR" to a directory containing one of the above files. If "CGAL"
provides a separate development package or SDK, be sure it has been
installed.
-- This program requires the CGAL library, and will not be compiled.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Users/ThirdPartyDesign/CGAL-5.0-examples/CGAL-5.0/examples/Triangulation_2