From d148e760c71685777996a2c2d23be1a329cb9a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20R=C3=B6hling?= Date: Thu, 12 May 2022 23:49:05 +0200 Subject: [PATCH] Turn AMENT_IMPORT_PREFIX into per-package variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Timo Röhling --- ament_cmake_core/cmake/core/templates/nameConfig.cmake.in | 4 ++-- .../cmake/ament_export_include_directories.cmake | 2 +- .../cmake/ament_cmake_export_libraries-extras.cmake.in | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ament_cmake_core/cmake/core/templates/nameConfig.cmake.in b/ament_cmake_core/cmake/core/templates/nameConfig.cmake.in index 5ce5db80..ac27dbf6 100644 --- a/ament_cmake_core/cmake/core/templates/nameConfig.cmake.in +++ b/ament_cmake_core/cmake/core/templates/nameConfig.cmake.in @@ -37,12 +37,12 @@ set(@PROJECT_NAME@_FOUND_AMENT_PACKAGE TRUE) # Compute relocatable install prefix. This is pretty much the same code as it # is generated by the CMakePackageConfigHelpers module. -get_filename_component(AMENT_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) +get_filename_component(@PROJECT_NAME@_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) # Use original install prefix if the package was merely found via symlink alias get_filename_component(_realCurr "${CMAKE_CURRENT_LIST_DIR}" REALPATH) get_filename_component(_realOrig "@CMAKE_INSTALL_PREFIX@/share/@PROJECT_NAME@/cmake" REALPATH) if(_realCurr STREQUAL _realOrig) - set(AMENT_IMPORT_PREFIX "@CMAKE_INSTALL_PREFIX@") + set(@PROJECT_NAME@_IMPORT_PREFIX "@CMAKE_INSTALL_PREFIX@") endif() unset(_realCurr) unset(_realOrig) diff --git a/ament_cmake_export_include_directories/cmake/ament_export_include_directories.cmake b/ament_cmake_export_include_directories/cmake/ament_export_include_directories.cmake index ffe7b2e1..fdf73144 100644 --- a/ament_cmake_export_include_directories/cmake/ament_export_include_directories.cmake +++ b/ament_cmake_export_include_directories/cmake/ament_export_include_directories.cmake @@ -37,7 +37,7 @@ macro(ament_export_include_directories) if(NOT IS_ABSOLUTE "${_arg}") # prefix relative paths with CMAKE_INSTALL_PREFIX # while avoiding to embed any absolute path - set(_arg "\${AMENT_IMPORT_PREFIX}/${_arg}") + set(_arg "\${${PROJECT_NAME}_IMPORT_PREFIX}/${_arg}") list_append_unique(_AMENT_EXPORT_RELATIVE_INCLUDE_DIRECTORIES "${_arg}") else() if(NOT IS_DIRECTORY "${_arg}") diff --git a/ament_cmake_export_libraries/cmake/ament_cmake_export_libraries-extras.cmake.in b/ament_cmake_export_libraries/cmake/ament_cmake_export_libraries-extras.cmake.in index 20633190..80baf466 100644 --- a/ament_cmake_export_libraries/cmake/ament_cmake_export_libraries-extras.cmake.in +++ b/ament_cmake_export_libraries/cmake/ament_cmake_export_libraries-extras.cmake.in @@ -39,7 +39,7 @@ if(NOT _exported_libraries STREQUAL "") set(_lib "NOTFOUND") find_library( _lib NAMES "${_library}" - PATHS "${AMENT_IMPORT_PREFIX}/lib" + PATHS "${@PROJECT_NAME@_IMPORT_PREFIX}/lib" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )