diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2015-09-18 12:03:43 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-09-18 12:03:43 +0200 |
| commit | 403e18004cb34638c41383472802a1b0afb898cd (patch) | |
| tree | 3008b0b5758442dabf30e4abb30b541096cd623e | |
| parent | 8d6052df46fcb653f37349967d43bca0ce3e7cdf (diff) | |
| parent | 5540d9db206c1c967f32d1e9f09f3568a275f3ae (diff) | |
| download | libgit2-403e18004cb34638c41383472802a1b0afb898cd.tar.gz | |
Merge pull request #3418 from DimStar77/master
pkg-config: fix directory references in libgit2.pc
| -rw-r--r-- | CMakeLists.txt | 17 | ||||
| -rw-r--r-- | libgit2.pc.in | 5 |
2 files changed, 20 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 293153f86..713640d6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,23 @@ SET(BIN_INSTALL_DIR bin CACHE PATH "Where to install binaries to.") SET(LIB_INSTALL_DIR lib CACHE PATH "Where to install libraries to.") SET(INCLUDE_INSTALL_DIR include CACHE PATH "Where to install headers to.") +# Set a couple variables to be substituted inside the .pc file. +# We can't just use LIB_INSTALL_DIR in the .pc file, as passing them as absolue +# or relative paths is both valid and supported by cmake. +SET (PKGCONFIG_PREFIX ${CMAKE_INSTALL_PREFIX}) + +IF(IS_ABSOLUTE ${LIB_INSTALL_DIR}) + SET (PKGCONFIG_LIBDIR ${LIB_INSTALL_DIR}) +ELSE(IS_ABSOLUTE ${LIB_INSTALL_DIR}) + SET (PKGCONFIG_LIBDIR "\${prefix}/${LIB_INSTALL_DIR}") +ENDIF (IS_ABSOLUTE ${LIB_INSTALL_DIR}) + +IF(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR}) + SET (PKGCONFIG_INCLUDEDIR ${INCLUDE_INSTALL_DIR}) +ELSE(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR}) + SET (PKGCONFIG_INCLUDEDIR "\${prefix}/${INCLUDE_INSTALL_DIR}") +ENDIF(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR}) + FUNCTION(TARGET_OS_LIBRARIES target) IF(WIN32) TARGET_LINK_LIBRARIES(${target} ws2_32) diff --git a/libgit2.pc.in b/libgit2.pc.in index 3d825a49f..880266a30 100644 --- a/libgit2.pc.in +++ b/libgit2.pc.in @@ -1,5 +1,6 @@ -libdir=@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@ -includedir=@CMAKE_INSTALL_PREFIX@/@INCLUDE_INSTALL_DIR@ +prefix=@PKGCONFIG_PREFIX@ +libdir=@PKGCONFIG_LIBDIR@ +includedir=@PKGCONFIG_INCLUDEDIR@ Name: libgit2 Description: The git library, take 2 |
