Skip to content

Use Imported Target for libgit2

CMake's pkg-config module does not add -L flags to xxx_LIBRARIES var, and so linking may fail if libgit2 isn't in a path known to the linker.

Use IMPORTED_TARGET argument in pkg_check_modules (available since CMake 3.6) to create a full imported target to libgit2. Update build and config file use to link to imported target.

Merge request reports