Skip to content

Commit

Permalink
Turn AMENT_IMPORT_PREFIX into per-package variable
Browse files Browse the repository at this point in the history
  • Loading branch information
roehling committed May 12, 2022
1 parent 87737e9 commit 8aad271
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ament_cmake_core/cmake/core/templates/nameConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down

0 comments on commit 8aad271

Please sign in to comment.