简体   繁体   中英

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.

Afterwards I successfully installed botan and tried to find the library using find_package(botan REQUIRED) as shown in the example here . 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

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? If not for cmake, how to use botan as vcpkg package at all? 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.

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. 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.

If you search on the internet, you can already find some versions of FindBotan.cmake, but none of them are official.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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