#1103703 libbotan-3-dev: cmake find_package wrongfully uses /usr/lib/include/botan-3

Package:
libbotan-3-dev
Source:
libbotan-3-dev
Description:
multiplatform crypto library (3.x version)
Submitter:
Paul Dreik
Date:
2025-04-20 19:03:05 UTC
Severity:
normal
#1103703#5
Date:
2025-04-20 18:59:14 UTC
From:
To:
Dear Maintainer,

After installing the package, I tried to use it from cmake with the following
in my CmakeLists.txt:

find_package(botan REQUIRED)

This gives an error in cmake configure:

CMake Error in CMakeLists.txt:
   Imported target "Botan::Botan" includes non-existent path

     "/usr/lib/include/botan-3"

   in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:


I think the error is that the logic for _Botan_PREFIX in
/usr/lib/x86_64-linux-gnu/cmake/Botan-3.7.1/botan-config.cmake:343
did not take into account to traverse above "x86_64-linux-gnu/"
If I insert yet another copy of this line:
get_filename_component(_Botan_PREFIX "${_Botan_PREFIX}" DIRECTORY)
it works, but I get to another packaging error.

In my CMakeLists.txt I have:

target_link_libraries(mytarget PRIVATE Botan::Botan)

and I get the following error:
ninja: error: '/usr/lib/libbotan-3.so.7', needed by 'mytarget', missing and no known rule to make it

According to apt-file (and it is also there on the file system), the real location is
/usr/lib/x86_64-linux-gnu/libbotan-3.so

Thanks,
Paul