diff --git a/CMakeLists.txt b/CMakeLists.txt index 78cd1c44..3c4baae5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,7 @@ set(ign_version_output "${PROJECT_NAME_LOWER}-config-version.cmake") set(ign_config_install_dir "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME_LOWER}") set(ign_pkgconfig_input "${CMAKE_CURRENT_SOURCE_DIR}/config/ignition-cmake.pc.in") set(ign_pkgconfig_output "${CMAKE_BINARY_DIR}/ignition-cmake${PROJECT_VERSION_MAJOR}.pc") +set(ign_pkgconfig_install_dir "${IGN_LIB_INSTALL_DIR}/pkgconfig") set(ign_utilities_target ${PROJECT_EXPORT_NAME}-utilities) set(ign_utilities_import_target_name ${PROJECT_EXPORT_NAME}::${ign_utilities_target}) set(ign_utilities_target_output_filename "${ign_utilities_target}-targets.cmake") @@ -86,11 +87,16 @@ install( #-------------------------------------- # Configure and install the pkgconfig file (needed for utilities headers) +file(RELATIVE_PATH + IGN_PC_CONFIG_RELATIVE_PATH_TO_PREFIX + "${CMAKE_INSTALL_PREFIX}/${ign_pkgconfig_install_dir}" + "${CMAKE_INSTALL_PREFIX}" +) configure_file(${ign_pkgconfig_input} ${ign_pkgconfig_output} @ONLY) install( FILES ${ign_pkgconfig_output} - DESTINATION ${IGN_LIB_INSTALL_DIR}/pkgconfig + DESTINATION ${ign_pkgconfig_install_dir} COMPONENT pkgconfig) #============================================================================ diff --git a/config/ignition-cmake.pc.in b/config/ignition-cmake.pc.in index 63e18137..ff8a8973 100644 --- a/config/ignition-cmake.pc.in +++ b/config/ignition-cmake.pc.in @@ -1,4 +1,4 @@ -prefix=@CMAKE_INSTALL_PREFIX@ +prefix=${pcfiledir}/@IGN_PC_CONFIG_RELATIVE_PATH_TO_PREFIX@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/ignition/@IGN_DESIGNATION@@PROJECT_VERSION_MAJOR@ Name: Ignition @IGN_DESIGNATION@