From 0c66d0c725ad1f977e2b907bc0619d6ceb6de238 Mon Sep 17 00:00:00 2001 From: Jacob Perron Date: Tue, 17 Dec 2019 15:23:16 -0800 Subject: [PATCH] Remove absolute path from installed CMake code (#948) Otherwise, rclcpp_components_register_node() fails if used from a fat archive. Related to https://github.com/ros2/ros2/issues/606. Signed-off-by: Jacob Perron --- rclcpp_components/rclcpp_components-extras.cmake.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rclcpp_components/rclcpp_components-extras.cmake.in b/rclcpp_components/rclcpp_components-extras.cmake.in index f1956c1..45a4e5a 100644 --- a/rclcpp_components/rclcpp_components-extras.cmake.in +++ b/rclcpp_components/rclcpp_components-extras.cmake.in @@ -25,7 +25,8 @@ macro(_rclcpp_components_register_package_hook) endif() endmacro() -set(@PROJECT_NAME@_NODE_TEMPLATE "@CMAKE_INSTALL_PREFIX@/@node_main_template_install_dir@/node_main.cpp.in") +get_filename_component(@PROJECT_NAME@_SHARE_DIR "${@PROJECT_NAME@_DIR}" DIRECTORY) +set(@PROJECT_NAME@_NODE_TEMPLATE "${@PROJECT_NAME@_SHARE_DIR}/node_main.cpp.in") include("${rclcpp_components_DIR}/rclcpp_components_register_nodes.cmake") include("${rclcpp_components_DIR}/rclcpp_components_register_node.cmake")