infinite macro invoke "symlink_install" and multi-package build
- 主要语言
- CMake
- 星标
- 125
- 派生
- 147
- PR 合并指标
- 30 天内没有已合并 PR
描述
I'm using a pure cmake build pipeline(without colcon build ... ) via adding the top cmakefilelists.txt file
```cmake
cmake_minimum_required(VERSION 3.14)
project("ROS2 Master")
find_package(ament_cmake_python REQUIRED)
set(AMENT_CMAKE_SYMLINK_INSTALL OFF CACHE BOOL "test" FORCE)
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/install CACHE PATH "test" FORCE)
function(colcon_add_subdirectories)
cmake_parse_arguments(PARSE_ARGV 0 "ARG" "" "BUILD_BASE;BASE_PATHS" "")
message("search criteria: ${ARGV}")
execute_process(COMMAND colcon list
--paths-only
--base-paths ${ARG_BASE_PATHS}
--topological-order
${ARG_UNPARSED_ARGUMENTS}
OUTPUT_VARIABLE paths)
string(STRIP "${paths}" paths)
string(REPLACE "\n" ";" paths "${paths}")
MESSAGE("colcon shows paths ${paths}")
foreach(path IN LISTS paths)
message("...examining ${path}")
# if(EXISTS "${path}/CMakeLists.txt")
execute_process(COMMAND colcon info --paths "${path}" OUTPUT_VARIABLE package_info)
if(NOT "${package_info}" MATCHES "type:[ \t]+(cmake|ros.ament_cmake|ros.cmake)")
message("skipping non-cmake project ${name}")
elseif(NOT "${package_info}" MATCHES "name:[ \t]+([^ \r\n\t]*)")
message(WARNING "could not identify package at ${path}")
else()
set(name "${CMAKE_MATCH_1}")
message("...adding package ${name} from path ${path}")
MESSAGE("package info: ${package_info}")
get_filename_component(BUILD_PATH "${name}" ABSOLUTE BASE_DIR "${ARG_BUILD_BASE}")
add_subdirectory("${path}" "${BUILD_PATH}")
endif()
endforeach()
endfunction()
colcon_add_subdirectories(
BUILD_BASE "${PROJECT_SOURCE_DIR}/build"
BASE_PATHS "${PROJECT_SOURCE_DIR}/src/"
#--packages-select ...
)
```
This file find all ament_cmake packages and invoke `add_subdirectory`
All ok if i turn off `AMENT_CMAKE_SYMLINK_INSTALL` option
But when AMENT_CMAKE_SYMLINK_INSTALL = ON I see infinite recursion function call
```cmake
CMake Error at /opt/ros/foxy/share/ament_cmake_core/cmake/symlink_install/install.cmake:25 (string):
Maximum recursion depth of 1000 exceeded
Call Stack (most recent call first):
/opt/ros/foxy/share/ament_cmake_core/cmake/symlink_install/install.cmake:44 (_install)
/opt/ros/foxy/share/ament_cmake_core/cmake/symlink_install/install.cmake:44 (_install)
/opt/ros/foxy/share/ament_cmake_core/cmake/symlink_install/install.cmake:44 (_install)
/opt/ros/foxy/share/ament_cmake_core/cmake/symlink_install/install.cmake:44 (_install)
....
```
I'm debug this and found that it's tries to call script infinitely `.../MY_BUILD_FOLDER/CURR_PACKAGE/ament_cmake_symlink_install/ament_cmake_symlink_install.cmake` on install configuration step
How to fix that?
P.S.
colcon uses another tool for creating link files (python os.symlink() function)
贡献指南
评估
这个 Issue 还没有评估数据。