2

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.

c3664698
  • 21
  • 3
  • Use powershell and vcpkg to install botan without cmake. IDE is VC2017? – seccpur Aug 29 '18 at 16:03
  • 1
    @seccpur If possible I want to use CMake to be able to compile it on different platforms. I installed botan, however CMake does not find it. – c3664698 Aug 29 '18 at 17:21
  • vcpkg can now install botan, but `find_package(botan REQUIRED)` still fails with the same error – Damian Apr 15 '21 at 08:44

1 Answers1

1

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.

alcroito
  • 401
  • 3
  • 13