Skip to content

Commit e6f1cff

Browse files
committed
Fix custom includedir & libdir substitution in pkg-config
Do not prepend ${prefix} to substituted includedir & libdir in the pkg-config file -- if the paths are overriden by user, CMake puts absolute paths there (even if user specifies a relative path). Instead, use the absolute path provided by CMake and appropriately default LIBRARY_INSTALL_DIR & INCLUDE_INSTALL_DIR to absolute paths with ${CMAKE_INSTALL_PREFIX} prepended. Fixes: open-source-parsers#279 Signed-off-by: Michał Górny <[email protected]>
1 parent 6444148 commit e6f1cff

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Diff for: CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ SET(LIB_SUFFIX "" CACHE STRING "Optional arch-dependent suffix for the library i
2525

2626
SET(RUNTIME_INSTALL_DIR bin
2727
CACHE PATH "Install dir for executables and dlls")
28-
SET(ARCHIVE_INSTALL_DIR lib${LIB_SUFFIX}
28+
SET(ARCHIVE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
2929
CACHE PATH "Install dir for static libraries")
30-
SET(LIBRARY_INSTALL_DIR lib${LIB_SUFFIX}
30+
SET(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
3131
CACHE PATH "Install dir for shared libraries")
32-
SET(INCLUDE_INSTALL_DIR include
32+
SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include
3333
CACHE PATH "Install dir for headers")
3434
SET(PACKAGE_INSTALL_DIR lib${LIB_SUFFIX}/cmake
3535
CACHE PATH "Install dir for cmake package config files")

Diff for: pkg-config/jsoncpp.pc.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
prefix=@CMAKE_INSTALL_PREFIX@
22
exec_prefix=${prefix}
3-
libdir=${exec_prefix}/@LIBRARY_INSTALL_DIR@
4-
includedir=${prefix}/@INCLUDE_INSTALL_DIR@
3+
libdir=@LIBRARY_INSTALL_DIR@
4+
includedir=@INCLUDE_INSTALL_DIR@
55

66
Name: jsoncpp
77
Description: A C++ library for interacting with JSON

0 commit comments

Comments
 (0)