[ros-users] [Discourse.ros.org] [Next Generation ROS] Creating a top CMakeLists.txt to standardize all the ROS2 core packages building with CMake

Ethan Gao ros.discourse at gmail.com
Mon Sep 3 11:10:43 UTC 2018

Now we can see it has different cases in the ros2 packages which are cloned with the [repo file](https://raw.githubusercontent.com/ros2/ros2/release-latest/ros2.repos):

- One case, it has a top CMakeLists.txt e.g [example_interfaces](https://github.com/ros2/example_interfaces) and I think it should be built normally for various building environment and OS
- The other case, the project doesn't contain any root CMakeLists.txt but separate CMakeLists.txt in each sub-folder (or say sub-projects/sub-packages) e.g [RCL](https://github.com/ros2/rcl.git) and [ament_cmake](https://github.com/ament/ament_cmake.git), This is very common in the ROS with the concept of meta package and I know that it works well to build with ament/colcon, but why it works is because the ament/colcon manually add codes to handle the kind of projects. but it's not the same for all the build environment and it will results in build failure when it doesn't find a `top CMakeLists.txt`

with a top CMakeLists.txt, it works for all, because it is the standard behaviour to CMake, so why not to add a top CMakeLists.txt to organize and propagate the whole building with the subsidiary packages or projects to make it standard ? or once the "No CMakeLists.txt" error found, there are so many packages to handle for this kind of ROS2 packages.(actually, now I met this kind of error when I try to enable ROS2 with another environment which merely supports to pass source tarball of a project (e.g rcl) to build the package (e.g) as RPM package)

PS: I know that it also works to wrap the corresponding build environment just like ament/colcon to bypass that kind of "No CMakeLists.txt" issue, but I'm try to discuss why not make it as the standard way of working for CMake directly, thanks ! :)

[Visit Topic](https://discourse.ros.org/t/creating-a-top-cmakelists-txt-to-standardize-all-the-ros2-core-packages-building-with-cmake/5933/1) or reply to this email to respond.

More information about the ros-users mailing list