Create and install pkg-config file This hasn't been working since the switch away from waf. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb93852..cc77f7b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,6 +99,7 @@ ENDIF ()
TARGET_LINK_LIBRARIES(git2 ${CMAKE_THREAD_LIBS_INIT})
SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})
SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_VERSION_MAJOR})
+CONFIGURE_FILE(libgit2.pc.in libgit2.pc)
# Install
INSTALL(TARGETS git2
@@ -106,6 +107,7 @@ INSTALL(TARGETS git2
LIBRARY DESTINATION ${INSTALL_LIB}
ARCHIVE DESTINATION ${INSTALL_LIB}
)
+INSTALL(FILES libgit2.pc DESTINATION ${INSTALL_LIB}/pkgconfig )
INSTALL(DIRECTORY include/git2 DESTINATION ${INSTALL_INC} )
INSTALL(FILES include/git2.h DESTINATION ${INSTALL_INC} )
diff --git a/libgit2.pc.in b/libgit2.pc.in
index ece5f2b..6165ad6 100644
--- a/libgit2.pc.in
+++ b/libgit2.pc.in
@@ -1,11 +1,9 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include
+libdir=@CMAKE_INSTALL_PREFIX@/@INSTALL_LIB@
+includedir=@CMAKE_INSTALL_PREFIX@/@INSTALL_INC@
Name: libgit2
Description: The git library, take 2
-Version: @version@
+Version: @LIBGIT2_VERSION_STRING@
Requires: libcrypto
Libs: -L${libdir} -lgit2 -lz -lcrypto
Cflags: -I${includedir}