From be2ca9013400da0d41e08e28f7a89a0f5f3c6d5d Mon Sep 17 00:00:00 2001 From: Stefan Profanter Date: Tue, 17 Nov 2020 13:23:56 +0100 Subject: [PATCH 1/3] fix: Use PACKAGE_PREFIX_DIR to ensure relocatable CMake install for conan Signed-off-by: Stefan Profanter --- cmake/ignition-config.cmake.in | 2 +- cmake/pkgconfig/ignition.pc.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/ignition-config.cmake.in b/cmake/ignition-config.cmake.in index df7c9fc1..7bd502fb 100644 --- a/cmake/ignition-config.cmake.in +++ b/cmake/ignition-config.cmake.in @@ -179,7 +179,7 @@ foreach(component ${@PKG_NAME@_FIND_COMPONENTS}) endforeach() # Specify the doxygen tag file -set(@PROJECT_NAME_NO_VERSION_UPPER@_DOXYGEN_TAGFILE "@CMAKE_INSTALL_PREFIX@/@IGN_DATA_INSTALL_DIR@/@PROJECT_NAME_LOWER@.tag.xml") +set(@PROJECT_NAME_NO_VERSION_UPPER@_DOXYGEN_TAGFILE "${PACKAGE_PREFIX_DIR}/@IGN_DATA_INSTALL_DIR@/@PROJECT_NAME_LOWER@.tag.xml") # Specify the API url. This is where the doxygen tag file will resolve URLS to. set(@PROJECT_NAME_NO_VERSION_UPPER@_API_URL "https://ignitionrobotics.org/api/@IGN_DESIGNATION@/@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@") diff --git a/cmake/pkgconfig/ignition.pc.in b/cmake/pkgconfig/ignition.pc.in index e2ee6c3f..18fd8f72 100644 --- a/cmake/pkgconfig/ignition.pc.in +++ b/cmake/pkgconfig/ignition.pc.in @@ -1,4 +1,4 @@ -prefix=@CMAKE_INSTALL_PREFIX@ +prefix=${pcfiledir}/../.. libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/ignition/@IGN_DESIGNATION@@PROJECT_VERSION_MAJOR@ From 1e39fa0a7acedd7b82cc5841dae860a2a426a192 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Fri, 8 Jan 2021 15:45:07 -0800 Subject: [PATCH 2/3] Compute ignition .pc file relative path to prefix Signed-off-by: Steve Peters --- cmake/IgnPackaging.cmake | 8 +++++++- cmake/pkgconfig/ignition-component.pc.in | 2 +- cmake/pkgconfig/ignition.pc.in | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake/IgnPackaging.cmake b/cmake/IgnPackaging.cmake index 907a04b9..4ee9e2d4 100644 --- a/cmake/IgnPackaging.cmake +++ b/cmake/IgnPackaging.cmake @@ -198,12 +198,18 @@ function(_ign_create_pkgconfig) endif() set(pkgconfig_output "${CMAKE_BINARY_DIR}/cmake/pkgconfig/${target_name}.pc") + set(pkgconfig_install_dir "${IGN_LIB_INSTALL_DIR}/pkgconfig") + file(RELATIVE_PATH + PC_CONFIG_RELATIVE_PATH_TO_PREFIX + "${CMAKE_INSTALL_PREFIX}/${pkgconfig_install_dir}" + "${CMAKE_INSTALL_PREFIX}" + ) configure_file(${pkgconfig_input} ${pkgconfig_output} @ONLY) install( FILES ${pkgconfig_output} - DESTINATION ${IGN_LIB_INSTALL_DIR}/pkgconfig + DESTINATION ${pkgconfig_install_dir} COMPONENT pkgconfig) endfunction() diff --git a/cmake/pkgconfig/ignition-component.pc.in b/cmake/pkgconfig/ignition-component.pc.in index 9837dee6..b542f394 100644 --- a/cmake/pkgconfig/ignition-component.pc.in +++ b/cmake/pkgconfig/ignition-component.pc.in @@ -1,4 +1,4 @@ -prefix=@CMAKE_INSTALL_PREFIX@ +prefix=${pcfiledir}/@PC_CONFIG_RELATIVE_PATH_TO_PREFIX@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/ignition/@IGN_DESIGNATION@@PROJECT_VERSION_MAJOR@ diff --git a/cmake/pkgconfig/ignition.pc.in b/cmake/pkgconfig/ignition.pc.in index 18fd8f72..d1cace02 100644 --- a/cmake/pkgconfig/ignition.pc.in +++ b/cmake/pkgconfig/ignition.pc.in @@ -1,4 +1,4 @@ -prefix=${pcfiledir}/../.. +prefix=${pcfiledir}/@PC_CONFIG_RELATIVE_PATH_TO_PREFIX@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/ignition/@IGN_DESIGNATION@@PROJECT_VERSION_MAJOR@ From b95d20f726a7d0eeb4f90b6ae9a16bf396585a57 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Fri, 8 Jan 2021 15:46:13 -0800 Subject: [PATCH 3/3] Compute path to prefix for ignition-cmake.pc Signed-off-by: Steve Peters --- CMakeLists.txt | 8 +++++++- config/ignition-cmake.pc.in | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) 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@