Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using find_package(botan) with botan 3.4.0 installed from conan #4132

Open
marty1885 opened this issue Jun 16, 2024 · 4 comments
Open

Using find_package(botan) with botan 3.4.0 installed from conan #4132

marty1885 opened this issue Jun 16, 2024 · 4 comments
Assignees

Comments

@marty1885
Copy link

Hi,

I'm trying to get Botan link to my program via conan. I noticed since 3.3.0 Botan comes with botan-config.cmake so I would expect find_package would be able to find Botan once installed. But I get the error

-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:4 (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.


-- Configuring incomplete, errors occurred!

Here is a minimal reproducible example: https://gist.github.com/marty1885/0438c66d3105c52ffd3508e18e00fb93
To reproduce

mkdir build
cd build
conan install .. -s compiler.cppstd=20 --output-folder=.
cmake .. -G "Visual Studio 17 2022" -T host=x64 -A x64 -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake"

OS: Windows
Compiler: MSVC

@reneme
Copy link
Collaborator

reneme commented Jun 16, 2024

Thanks for the minimal example. I'll look into it tomorrow.

For now: the CMake config shipped with Botan isn't integrated with Conan. Frankly, I'm not even sure it should be. But that's just guess work on my side.

@reneme reneme self-assigned this Jun 16, 2024
@marty1885
Copy link
Author

Thanks. I need a universal way to use botan no matter if it's installed from conan or a system package.

@reneme
Copy link
Collaborator

reneme commented Jun 17, 2024

For the record: This doesn't work neither on Windows nor on Linux.
The conan package does install the cmake config files (in .conan2/.../lib/cmake/Botan-3.4.0) but cmake is not picking it up from there.

@reneme
Copy link
Collaborator

reneme commented Jun 17, 2024

From this conan documention page I understand that it is possible but not advised to redirect to package-provided *-config.cmake files. Apparently this may break compatibility with other non-cmake build systems and also is not compatible with multi-configuration builds. Instead, they suggest to combine the CMakeToolchain and CMakeDeps conan generators.

Unfortunately, I didn't use conan to consume packages recently. So any thoughts and feedback is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants