VCPKG CMAKE没有找到植物

vcpkg cmake does not find botan

本文关键字:CMAKE VCPKG      更新时间:2023-10-16

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

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

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,如何将博坦用作vcpkg包?对位置进行硬编码不是一个可行的解决方案。

谢谢四个你的帮助。

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

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

如果你在互联网上搜索,你已经可以找到一些版本的FindBotan.cmake,但它们都不是官方的。