From ec85d5f1b2e126018eef1ff96db71c9c606652a5 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Fri, 16 Aug 2024 16:28:05 -0500 Subject: [PATCH] Use relative paths for pkg-config install directory (#443) Signed-off-by: Addisu Z. Taddese --- CMakeLists.txt | 5 +++-- cmake/GzPackaging.cmake | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6245b4e5..17944664 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,8 @@ set(gz_version_output "${PROJECT_NAME_LOWER}-config-version.cmake") set(gz_config_install_dir "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME_LOWER}") set(gz_pkgconfig_input "${CMAKE_CURRENT_SOURCE_DIR}/config/gz-cmake.pc.in") set(gz_pkgconfig_output "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc") -set(gz_pkgconfig_install_dir "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") +set(gz_pkgconfig_install_dir "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +set(gz_pkgconfig_abs_install_dir "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") set(gz_utilities_target ${PROJECT_EXPORT_NAME}-utilities) set(gz_utilities_import_target_name ${PROJECT_EXPORT_NAME}::${gz_utilities_target}) set(gz_utilities_target_output_filename "${gz_utilities_target}-targets.cmake") @@ -96,7 +97,7 @@ install( # Configure and install the pkgconfig file (needed for utilities headers) file(RELATIVE_PATH GZ_PC_CONFIG_RELATIVE_PATH_TO_PREFIX - "${gz_pkgconfig_install_dir}" + "${gz_pkgconfig_abs_install_dir}" "${CMAKE_INSTALL_PREFIX}" ) diff --git a/cmake/GzPackaging.cmake b/cmake/GzPackaging.cmake index 1e7d8004..d131193d 100644 --- a/cmake/GzPackaging.cmake +++ b/cmake/GzPackaging.cmake @@ -199,10 +199,11 @@ function(_gz_create_pkgconfig) endif() set(pkgconfig_output "${CMAKE_BINARY_DIR}/cmake/pkgconfig/${target_name}.pc") - set(pkgconfig_install_dir "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") + set(pkgconfig_install_dir "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + set(pkgconfig_abs_install_dir "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig") file(RELATIVE_PATH PC_CONFIG_RELATIVE_PATH_TO_PREFIX - "${pkgconfig_install_dir}" + "${pkgconfig_abs_install_dir}" "${CMAKE_INSTALL_PREFIX}" )