I'm trying to use target_find_dependencies to add the dependencies for a STATIC library that depends on some libraries that can be found via pkg-config, I'm able to pass the PkgConfig package to target_find_dependencies but there doesn't seem to be an easy way to add the pkg_check_modules calls to the CMake package config, is there any way I can solve this situation?
My old Config.cmake.in file used to look like this:
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Threads)
find_dependency(PkgConfig)
if(NOT TARGET PkgConfig::gio)
pkg_check_modules(gio REQUIRED IMPORTED_TARGET gio-2.0)
endif()
if(NOT TARGET PkgConfig::dbus)
pkg_check_modules(dbus REQUIRED IMPORTED_TARGET dbus-1)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/@TARGET_NAME@Targets.cmake")
check_required_components(@TARGET_NAME@)
I'm trying to use
target_find_dependenciesto add the dependencies for aSTATIClibrary that depends on some libraries that can be found viapkg-config, I'm able to pass thePkgConfigpackage totarget_find_dependenciesbut there doesn't seem to be an easy way to add thepkg_check_modulescalls to the CMake package config, is there any way I can solve this situation?My old
Config.cmake.infile used to look like this: