From 29fae9f5ad29e93882ab3b8c67ca63d01445adfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernd=20M=C3=BCller?= Date: Mon, 29 Jan 2024 17:49:25 +0100 Subject: [PATCH] take changes from https://github.com/ros/urdfdom_headers/pull/66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernd Müller --- CMakeLists.txt | 9 ++++++++- cmake/pkgconfig/urdfdom_headers.pc.in | 2 +- cmake/urdfdom_headers-config.cmake.in | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b7de60..5544c0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ option(APPEND_PROJECT_NAME_TO_INCLUDEDIR if(APPEND_PROJECT_NAME_TO_INCLUDEDIR) set(CMAKE_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}") + set(CMAKE_INSTALL_FULL_INCLUDEDIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}/${PROJECT_NAME}") endif() set (URDF_MAJOR_VERSION 1) @@ -33,9 +34,14 @@ if(WIN32 AND NOT CYGWIN) else() set(CMAKE_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/cmake) endif() -string(REGEX REPLACE "[^/]+" ".." RELATIVE_PATH_CMAKE_DIR_TO_PREFIX "${CMAKE_CONFIG_INSTALL_DIR}") +file(RELATIVE_PATH RELATIVE_PATH_CMAKE_DIR_TO_PREFIX "${CMAKE_CONFIG_INSTALL_DIR}" "${CMAKE_INSTALL_PREFIX}") set(PACKAGE_NAME ${PROJECT_NAME}) +string(REPLACE + "${CMAKE_INSTALL_PREFIX}" + "\${${PROJECT_NAME}_DIR}/${RELATIVE_PATH_CMAKE_DIR_TO_PREFIX}" + cmake_conf_include_dir + "${CMAKE_INSTALL_FULL_INCLUDEDIR}") set(cmake_conf_file "${PROJECT_NAME}-config.cmake") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/${cmake_conf_file}.in" "${CMAKE_BINARY_DIR}/${cmake_conf_file}" @ONLY) set(cmake_conf_version_file "${PROJECT_NAME}-config-version.cmake") @@ -55,6 +61,7 @@ install(FILES # Make the package config file set(PACKAGE_DESC "Unified Robot Description Format") +string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${prefix}" pkg_conf_includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") set(pkg_conf_file "urdfdom_headers.pc") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig/${pkg_conf_file}.in" "${CMAKE_BINARY_DIR}/${pkg_conf_file}" @ONLY) install(FILES "${CMAKE_BINARY_DIR}/${pkg_conf_file}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ COMPONENT pkgconfig) diff --git a/cmake/pkgconfig/urdfdom_headers.pc.in b/cmake/pkgconfig/urdfdom_headers.pc.in index 7903698..3abcacf 100644 --- a/cmake/pkgconfig/urdfdom_headers.pc.in +++ b/cmake/pkgconfig/urdfdom_headers.pc.in @@ -1,7 +1,7 @@ # This file was generated by CMake for @PROJECT_NAME@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +includedir=@pkg_conf_includedir@ Name: @PACKAGE_NAME@ Description: @PACKAGE_DESC@ diff --git a/cmake/urdfdom_headers-config.cmake.in b/cmake/urdfdom_headers-config.cmake.in index b53e466..a5b38ea 100644 --- a/cmake/urdfdom_headers-config.cmake.in +++ b/cmake/urdfdom_headers-config.cmake.in @@ -3,7 +3,7 @@ if (@PACKAGE_NAME@_CONFIG_INCLUDED) endif() set(@PACKAGE_NAME@_CONFIG_INCLUDED TRUE) -set(@PACKAGE_NAME@_INCLUDE_DIRS "${@PROJECT_NAME@_DIR}/@RELATIVE_PATH_CMAKE_DIR_TO_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@") +set(@PACKAGE_NAME@_INCLUDE_DIRS "@cmake_conf_include_dir@") include("${@PACKAGE_NAME@_DIR}/@PACKAGE_NAME@Export.cmake")