FindPkgConfig: imported target missing libraries
$ pkg-config --libs libmutter-2
-L/usr/lib/mutter -lmutter-2 -lgtk-3 -lgdk-3 -lmutter-clutter-2 -lcairo-gobject -latk-1.0 -lpangocairo-1.0 -lpango-1.0 -lfribidi -ljson-glib-1.0 -lgio-2.0 -lwayland-egl -lwayland-client -lXtst -lXi -lmutter-cogl-2 -lcairo -lgmodule-2.0 -pthread -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lgbm -ldrm -lwayland-server -lEGL -lXext -lXdamage -lXfixes -lXcomposite -lXrandr -lX11
Most of the libraries are located in /usr/lib
, but there is no -L/usr/lib
of course.
Because _pkg_create_imp_target()
calls find_library()
with NO_DEFAULT_PATH
(if it sees any -L
option), almost all libraries aren't found -> not added to the imported target. And then linking fails.
Why is NO_DEFAULT_PATH
added to search options (https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindPkgConfig.cmake#L205)? Is it really necessary?