diff --git a/rclcpp_components/CMakeLists.txt b/rclcpp_components/CMakeLists.txt index 95ba47fa93..c0c3d595bf 100644 --- a/rclcpp_components/CMakeLists.txt +++ b/rclcpp_components/CMakeLists.txt @@ -41,6 +41,11 @@ ament_target_dependencies(component_container "rclcpp" ) +install(FILES + src/node_main.cpp.in + DESTINATION ${PROJECT_BINARY_DIR} +) + add_executable( component_container_mt src/component_container_mt.cpp diff --git a/rclcpp_components/cmake/rclcpp_components_register_node.cmake b/rclcpp_components/cmake/rclcpp_components_register_node.cmake index daa2db32c6..81126d879b 100644 --- a/rclcpp_components/cmake/rclcpp_components_register_node.cmake +++ b/rclcpp_components/cmake/rclcpp_components_register_node.cmake @@ -45,9 +45,10 @@ macro(rclcpp_components_register_node target) set(_RCLCPP_COMPONENTS__NODES "${_RCLCPP_COMPONENTS__NODES}${component};${_path}/$\n") set(CLASS_NAME ${component}) - configure_file(../../rclcpp/rclcpp_components/src/node_main.cpp.in - ../../rclcpp/rclcpp_components/src/node_main_${node}.cpp @ONLY) - add_executable(${node} ../../rclcpp/rclcpp_components/src/node_main_${node}.cpp) + set(build_dir ${PROJECT_BINARY_DIR}/../rclcpp_components) + configure_file(${build_dir}/node_main.cpp.in + ${build_dir}/node_main_${node}.cpp @ONLY) + add_executable(${node} ${build_dir}/node_main_${node}.cpp) set(lib ${target}) # Needed so symbols aren't dropped if not usesd if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")