gpt4 book ai didi

c++ - vcpkg cmake 找不到 botan

转载 作者:行者123 更新时间:2023-11-30 04:57:18 28 4
gpt4 key购买 nike

我使用 vcpkg 作为我的包管理器,按照示例很容易构建 example用sqlite。

之后我成功安装了 botan 并尝试使用find_package(botan REQUIRED) 如示例所示 here .然而不幸的是,这不起作用并且生成错误退出

CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:247 (_find_package):
By not providing "Findbotan.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "botan", but
CMake did not find one.

Could not find a package configuration file provided by "botan" with any of
the following names:

botanConfig.cmake
botan-config.cmake

Add the installation prefix of "botan" to CMAKE_PREFIX_PATH or set
"botan_DIR" to a directory containing one of the above files. If "botan"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
CMakeLists.txt:4 (find_package

CMakeLists.txt 如下所示

cmake_minimum_required(VERSION 3.0)
project(botanTest)

find_package(botan REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main botan)

有没有办法用 cmake 和 vcpkg 构建依赖于 botan 的应用程序?如果不是 cmake,如何将 botan 用作 vcpkg 包?对位置进行硬编码不是可行的解决方案。

谢谢四位的帮助。

最佳答案

vcpkg 不为构建和安装的 Botan 提供配置文件。

您必须直接在您的 CMake 项目中使用 find_path() 和 find_library(),或者编写一个 FindBotan.cmake 文件,该文件将由 find_package() 调用找到。在这个 FindBotan.cmake 中,您仍然需要使用 find_path() 和 find_library() 以及出现在 Find 模块中的一些其他常用样板。

如果你在网上搜索,你已经可以找到 FindBotan.cmake 的一些版本,但没有一个是官方的。

关于c++ - vcpkg cmake 找不到 botan,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52081449/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com