I've installed taglib
with manifest mode, but am unable to use find_package(Taglib)
(I've tried taglib, Taglib, TagLib, etc). I get the following error
CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:853 (_find_package):
Could not find a package configuration file provided by "Taglib" with any
of the following names:
TaglibConfig.cmake
taglib-config.cmake
Add the installation prefix of "Taglib" to CMAKE_PREFIX_PATH or set
"Taglib_DIR" to a directory containing one of the above files. If "Taglib"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
CMakeLists.txt:40 (find_package)
There seems to be no "taglib" variables exported at all, Taglib_DIR
has the value Taglib_DIR-NOTFOUND
.
I've had that issue before with other packages, but some combination of rebuilding/reinstalling, executing the bootstrap script or random other fiddling solved it so far. I see a taglib-config.cmake
in ./vcpkg/buildtrees/taglib/src/v1.13-5298fc2c7f.clean/taglib-config.cmake
, and another in ./vcpkg/buildtrees/taglib/x64-linux-rel/taglib-config
(not a .cmake file).
Other packages installed through vcpkg typically have a config file defined in vcpkg_installed/x64-linux/share/<package>
, like vcpkg_installed/x64-linux/share/immer/ImmerConfig.cmake
, but taglib does not.
I am loading the vcpkg toolchain file.
Am I missing something? Thanks!
Edit: based on the below answer and an answer from GitHub I'm using the following:
find_package(PkgConfig)
pkg_check_modules(TAGLIB REQUIRED IMPORTED_TARGET taglib)
target_link_libraries(thetarget PRIVATE PkgConfig::TAGLIB)
Even though taglib has some files named taglib-config.cmake
, it does not support to be used with cmake directly and do not export targets.
Instead, taglib installs package config files. You'll need to use the package config module:
find_package(PkgConfig)
Then use the package config functions:
pkg_check_modules(taglib REQUIRED)
Normally it should define variables such as taglib_INCLUDE_DIR
and taglib_LINK_LIBRARIES
that you can use to add compile requirements to your targets.