Bug 478669 - FindLibGit2 checks the wrong pkgconfig library name
Summary: FindLibGit2 checks the wrong pkgconfig library name
Status: RESOLVED FIXED
Alias: None
Product: extra-cmake-modules
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.246.0
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: ecm-bugs-null@kde.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-17 23:20 UTC by Louis Moureaux
Modified: 2023-12-23 00:45 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Louis Moureaux 2023-12-17 23:20:17 UTC
SUMMARY

The FindLibGit2 module queries pkgconfig for the "git2" module. The actual module is called "libgit2", at least on Kde Neon and Fedora 40. This can be verified by checking the name of the ".pc" file.

STEPS TO REPRODUCE
1. Use FindLibGit2 with a custom build of libgit2, not in the system library path
2. Provide the correct path to pkg-config by setting CMAKE_PREFIX_PATH appropriately
3. find_package(LibGit2) fails to find libgit2
4. Change the module name to "libgit2" in FindLibGit2.cmake
5. find_package(LibGit2) finds libgit2 correctly

OBSERVED RESULT

find_package(LibGit2) cannot find the custom libgit2.

EXPECTED RESULT

find_package(LibGit2) finds the custom libgit2.

SOFTWARE/OS VERSIONS
Linux: Custom environment used by the CMS Experiment at CERN
KDE Frameworks Version: Find module copied from current master
Comment 1 Nicolas Fella 2023-12-23 00:44:20 UTC
Git commit a0fa560da8fb194aced9018304b63a1defae26a3 by Nicolas Fella, on behalf of Louis Moureaux.
Committed on 23/12/2023 at 01:44.
Pushed by nicolasfella into branch 'master'.

Fixes to FindLibGit2.cmake

* Correct the name of the pkg-config module
* Correct the version regex to work with libgit2 1.7.1

M  +6    -5    find-modules/FindLibGit2.cmake

https://invent.kde.org/frameworks/extra-cmake-modules/-/commit/a0fa560da8fb194aced9018304b63a1defae26a3
Comment 2 Nicolas Fella 2023-12-23 00:45:51 UTC
Git commit 97fdb28ff73cc4213e8a26099e68bbc88fd23188 by Nicolas Fella, on behalf of Louis Moureaux.
Committed on 23/12/2023 at 01:45.
Pushed by nicolasfella into branch 'kf5'.

Fixes to FindLibGit2.cmake

* Correct the name of the pkg-config module
* Correct the version regex to work with libgit2 1.7.1
(cherry picked from commit a0fa560da8fb194aced9018304b63a1defae26a3)

M  +6    -5    find-modules/FindLibGit2.cmake

https://invent.kde.org/frameworks/extra-cmake-modules/-/commit/97fdb28ff73cc4213e8a26099e68bbc88fd23188