From 9128054a12ecd9c9cdeca4a6fd96e80780054c93 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Mon, 31 Oct 2022 19:20:00 +0100 Subject: [PATCH] cmake: make the .pc file relocatable Instead of writing absolute file paths for exec_prefix, libdir and includedir make them all relative to prefix. This makes the .pc file match the autotools generated one and allows changing all paths via prefix. Before: prefix=C:/test exec_prefix=C:/test libdir=C:/test/lib includedir=C:/test/include After: prefix=C:/test exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cdd38335..006c026c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -457,9 +457,9 @@ set(abs_top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}") set(abs_top_builddir "${CMAKE_CURRENT_BINARY_DIR}") # libnghttp2.pc (pkg-config file) set(prefix "${CMAKE_INSTALL_PREFIX}") -set(exec_prefix "${CMAKE_INSTALL_PREFIX}") -set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}") -set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") +set(exec_prefix "\${prefix}") +set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") +set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") set(VERSION "${PACKAGE_VERSION}") # For init scripts and systemd service file (in contrib/) set(bindir "${CMAKE_INSTALL_FULL_BINDIR}")