简体   繁体   English

vcpkg cmake 找不到 botan

[英]vcpkg cmake does not find botan

I use vcpkg as my package manager, following the example it was quite easy to build the example with sqlite.我使用 vcpkg 作为我的包管理器,按照示例使用 sqlite 构建示例非常容易。

Afterwards I successfully installed botan and tried to find the library using find_package(botan REQUIRED) as shown in the example here .后来我成功安装了牡丹,并试图找到利用图书馆find_package(botan REQUIRED)所示的例子在这里 However unfortunately this does not work and the generation exits with the error但是不幸的是,这不起作用并且生成退出并出现错误

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

The CMakeLists.txt looks like the following CMakeLists.txt 如下所示

cmake_minimum_required(VERSION 3.0)
project(botanTest)

find_package(botan REQUIRED)

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

Is there a way to build an application that depends on botan with cmake and vcpkg?有没有办法使用 cmake 和 vcpkg 构建依赖于 botan 的应用程序? If not for cmake, how to use botan as vcpkg package at all?如果不是 cmake,如何使用 botan 作为 vcpkg 包? Hardcoding the location is not a viable solution.硬编码位置不是一个可行的解决方案。

Thanks four your help.谢谢四位帮忙。

vcpkg does not provide a Config file for a built and installed Botan. vcpkg 不为构建和安装的 Botan 提供配置文件。

You will either have to use find_path() and find_library() directly in your CMake project, or write a FindBotan.cmake file which would be found by a find_package() call.您要么必须直接在 CMake 项目中使用 find_path() 和 find_library(),要么编写一个 FindBotan.cmake 文件,该文件将通过 find_package() 调用找到。 Inside this FindBotan.cmake you would still need to use find_path() and find_library() plus some other usual boilerplate that appears in Find modules.在此 FindBotan.cmake 中,您仍然需要使用 find_path() 和 find_library() 以及出现在 Find 模块中的其他一些常用样板。

If you search on the internet, you can already find some versions of FindBotan.cmake, but none of them are official.如果您在互联网上搜索,您已经可以找到某些版本的 FindBotan.cmake,但没有一个是官方版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM