From 5417ea5f1f33f62e2511bda74477da05dce900a3 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Sun, 14 Apr 2024 12:07:15 -0500 Subject: CMake: Use imported targets for PkgConfig packages (#954) This carries include directories and the required link flags. Several libraries brought in through pkg_check_modules aren't linked correctly using the _LDFLAGS variables. Instead, they link the libraries directly with `-l`. This is problematic because it doesn't properly pull in the actual directory of the library being linked when it is not in a system library directory. Likewise, the necessary include directories for several of these targets aren't properly set either. Linking against the imported targets automatically pulls in the necessary include directories. --- CMake/variables.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'CMake/variables.cmake') diff --git a/CMake/variables.cmake b/CMake/variables.cmake index cbf6ffdf3..20a36eda8 100644 --- a/CMake/variables.cmake +++ b/CMake/variables.cmake @@ -45,9 +45,9 @@ if(WIN32) elseif(APPLE AND NOT FLTK_BACKEND_X11) list(APPEND FLTK_LDLIBS ${FLTK_COCOA_FRAMEWORKS}) elseif(FLTK_BACKEND_WAYLAND) - list(APPEND FLTK_LDLIBS "-lwayland-cursor -lwayland-client -lxkbcommon -ldbus-1") + list(APPEND FLTK_LDLIBS PkgConfig::WLDCURSOR PkgConfig::WLDCLIENT PkgConfig::XKBCOMMON PkgConfig::DBUS) if(USE_SYSTEM_LIBDECOR) - list(APPEND FLTK_LDLIBS "-ldecor-0") + list(APPEND FLTK_LDLIBS PkgConfig::SYSTEM_LIBDECOR) endif(USE_SYSTEM_LIBDECOR) else() list(APPEND FLTK_LDLIBS -lm) -- cgit v1.2.3