Skip to content

Must <buildtool_export_depend>ament_cmake_core when using some of the CMake functions #375

Open
@sloretz

Description

@sloretz

Check out this CMake error from a plain CMake packge ros/angles#32 (comment)

CMake Error at /home/sloretz/ws/ros2/install/angles/share/angles/cmake/ament_cmake_export_include_directories-extras.cmake:8 (find_package):
  By not providing "Findament_cmake_core.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "ament_cmake_core", but CMake did not find one.

  Could not find a package configuration file provided by "ament_cmake_core"
  with any of the following names:

    ament_cmake_coreConfig.cmake
    ament_cmake_core-config.cmake

  Add the installation prefix of "ament_cmake_core" to CMAKE_PREFIX_PATH or
  set "ament_cmake_core_DIR" to a directory containing one of the above
  files.  If "ament_cmake_core" provides a separate development package or
  SDK, be sure it has been installed.

The problem is the CMake code generated as a result of ament_cmake_export_include_directories() is find_packaging ament_cmake_core. That means any package using angles has a buildtool dependency on ament_cmake_core, so packages using ament_cmake_export_include_directories must have a <buildtool_export_depend>ament_cmake_core</ in their package.xml or plain CMake packages using them will fail to build. However, ros2 packages aren't currently commonly doing this.

Is it possible to make it so the generated CMake code has no dependency on ament_cmake? That would eliminate bugs like that.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions