Skip to content

target_find_dependencies and pkg-config #253

Open
@ddassie-texa

Description

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}/@[email protected]")

check_required_components(@TARGET_NAME@)

Upvote & Fund

@aminya is using Polar.sh so you can upvote and help fund this issue. The funding is received once the issue is completed & confirmed by you.

Thank you in advance for helping prioritize & fund our backlog!


Fund with Polar

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions