pkg_check_modules creates broken targets for msvc
using pkg_check_modules to find imported targets may result in targets containing libraries without its path for msvc:
For example, having the glib.pc down here _LINK_LIBRARIES only lists glib-2.0 intl
without their path.
glib.pc:
prefix=C:/gtk-build/gtk/x64/release
includedir=${prefix}/include
libdir=${prefix}/lib
bindir=${prefix}/bin
glib_genmarshal=${bindir}/glib-genmarshal
gobject_query=${bindir}/gobject-query
glib_mkenums=${bindir}/glib-mkenums
Name: GLib
Description: C Utility Library
Version: 2.72.2
Libs: -L${libdir} -lglib-2.0 -lintl
Libs.private: -lws2_32 -lwinmm
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include
Another example for GTK3:
[cmake] -- GTK3_LINK_LIBRARIES: gtk-3;gdk-3;C:/Windows/System32/gdi32.dll;C:/Windows/System32/imm32.dll;C:/Windows/System32/shell32.dll;C:/Windows/System32/ole32.dll;C:/Windows/System32/winmm.dll;C:/Windows/System32/dwmapi.dll;C:/Windows/System32/setupapi.dll;C:/Windows/System32/cfgmgr32.dll;C:/Windows/System32/hid.dll;winspool;C:/Windows/System32/comctl32.dll;C:/Windows/System32/comdlg32.dll;pangowin32-1.0;pangocairo-1.0;pango-1.0;P:/vcpkg/installed/x64-windows/debug/bin/harfbuzz.dll;atk-1.0;cairo-gobject;cairo;gio-2.0;gdk_pixbuf-2.0;gobject-2.0;glib-2.0;intl
[cmake] -- GTK3_LIBRARIES = gtk-3;gdk-3;gdi32;imm32;shell32;ole32;winmm;dwmapi;setupapi;cfgmgr32;hid;winspool;comctl32;comdlg32;pangowin32-1.0;pangocairo-1.0;pango-1.0;harfbuzz;atk-1.0;cairo-gobject;cairo;gio-2.0;gdk_pixbuf-2.0;gobject-2.0;glib-2.0;intl
[cmake] -- GTK3_LIBRARY_DIRS = C:/gtk-build/gtk/x64/release/lib
Note, that GTK3_LIBRARY_DIRS is not in the path, so the linker is unable to find those.
Edited by Fabian Keßler