From 203c65c562453385e3ffc4485844b15e80b93107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wro=CC=81bel?= Date: Fri, 17 Sep 2021 00:07:08 +0200 Subject: [PATCH] FindCanberra: link against target provided by pkgconfig target_link_libraries() against the target generated by pkg_check_modules() so that the additional linker options are not lost, such as the additional libraries to link against when building statically. BUG: 442555 --- find-modules/FindCanberra.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/find-modules/FindCanberra.cmake b/find-modules/FindCanberra.cmake index c54adf99..f9561118 100644 --- a/find-modules/FindCanberra.cmake +++ b/find-modules/FindCanberra.cmake @@ -34,7 +34,7 @@ Since 5.56.0. #]=======================================================================] find_package(PkgConfig QUIET) -pkg_check_modules(PC_Canberra libcanberra QUIET) +pkg_check_modules(PC_Canberra REQUIRED IMPORTED_TARGET libcanberra QUIET) find_library(Canberra_LIBRARIES NAMES canberra @@ -66,6 +66,7 @@ if(Canberra_FOUND AND NOT TARGET Canberra::Canberra) INTERFACE_COMPILE_OPTIONS "${PC_Canberra_CFLAGS}" INTERFACE_INCLUDE_DIRECTORIES "${Canberra_INCLUDE_DIRS}" ) + target_link_libraries(Canberra::Canberra INTERFACE PkgConfig::PC_Canberra) endif() mark_as_advanced(Canberra_LIBRARIES Canberra_INCLUDE_DIRS Canberra_VERSION) -- GitLab