diff options
| author | Jordan Williams <jordan@jwillikers.com> | 2024-04-14 12:07:15 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-14 19:07:15 +0200 |
| commit | 5417ea5f1f33f62e2511bda74477da05dce900a3 (patch) | |
| tree | dbf96e812217786a4f5eee4c25fab51a823766b9 /src | |
| parent | 2818a36064365e63e32de6850c65544dd1fdfb07 (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b12880c3b..326fb5d09 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -535,7 +535,7 @@ if(FLTK_USE_X11) endif(FLTK_USE_X11) if(FLTK_BACKEND_WAYLAND) - pkg_check_modules(DBUS dbus-1) + pkg_check_modules(DBUS IMPORTED_TARGET dbus-1) set(IDIRS "${CMAKE_CURRENT_BINARY_DIR}") set(CDEFS "_GNU_SOURCE;HAVE_MEMFD_CREATE;HAVE_MKOSTEMP;HAVE_POSIX_FALLOCATE") set(COPTS "-fPIC") @@ -676,10 +676,10 @@ endif(HAVE_XRENDER) if(USE_PANGO) ### FIXME ### This needs to use the PKG_* variables directly - list(APPEND OPTIONAL_LIBS ${HAVE_LIB_PANGO} ${HAVE_LIB_PANGOCAIRO}) - list(APPEND OPTIONAL_LIBS ${HAVE_LIB_CAIRO} ${HAVE_LIB_GOBJECT}) + list(APPEND OPTIONAL_LIBS ${HAVE_LIB_PANGO} PkgConfig::PANGOCAIRO) + list(APPEND OPTIONAL_LIBS PkgConfig::CAIRO ${HAVE_LIB_GOBJECT}) if(USE_PANGOXFT) - list(APPEND OPTIONAL_LIBS ${HAVE_LIB_PANGOXFT}) + list(APPEND OPTIONAL_LIBS PkgConfig::PANGOXFT) endif(USE_PANGOXFT) endif(USE_PANGO) @@ -754,16 +754,16 @@ if(UNIX AND FLTK_BACKEND_WAYLAND) endif() if(FLTK_USE_GL) - list(APPEND OPTIONAL_LIBS "-lwayland-egl -lEGL") + list(APPEND OPTIONAL_LIBS PkgConfig::WLD_EGL PkgConfig::PKG_EGL) endif(FLTK_USE_GL) if(USE_SYSTEM_LIBDECOR) - list(APPEND OPTIONAL_LIBS "-ldecor-0") + list(APPEND OPTIONAL_LIBS PkgConfig::SYSTEM_LIBDECOR) elseif(GTK_FOUND AND FLTK_USE_LIBDECOR_GTK) - list(APPEND OPTIONAL_LIBS ${GTK_LDFLAGS} ) + list(APPEND OPTIONAL_LIBS PkgConfig::GTK) endif(USE_SYSTEM_LIBDECOR) - list(APPEND OPTIONAL_LIBS "-lwayland-cursor -lwayland-client -lxkbcommon -ldl") + list(APPEND OPTIONAL_LIBS PkgConfig::WLDCURSOR PkgConfig::WLDCLIENT PkgConfig::XKBCOMMON -ldl) if(DBUS_FOUND) - list(APPEND OPTIONAL_LIBS "${DBUS_LDFLAGS}") + list(APPEND OPTIONAL_LIBS PkgConfig::DBUS) endif(DBUS_FOUND) endif(UNIX AND FLTK_BACKEND_WAYLAND) |
