Skip to content

kai-waang/colcon-toplevel-cmake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toplevel CMakeLists.txt for developing ROS 2 with CLion and colcon

Usage

Basically you can clone this repo into a common directory, e.g. /opt/ros/scripts/cmake

git clone https://github.com/kai-waang/colcon-toplevel-cmake /opt/ros/scripts/cmake

Then you can just create a CMakeLists.txt in your ROS 2 workspace root directory with the following content:

cmake_minimum_required(VERSION 3.14)
project("ros2_project")

include("/opt/ros/scripts/cmake/colcon.cmake")

# only for clion highlighting and analysis
colcon_add_subdirectories(
        BUILD_BASE "${PROJECT_SOURCE_DIR}/build"
        BASE_PATHS "${PROJECT_SOURCE_DIR}/src/"
        # --packages-select  
)

Or you can just copy the toplevel.cmake from this repo to your workspace root directory.

cp /opt/ros/scripts/cmake/toplevel.cmake /path/to/your/ros2/workspace

If you clone this in different directory as this repo, you should modify the include(...) correspondingly

# ...
include("/path/to/your/ros2/workspace/toplevel.cmake")

Acknowledgement

This repo is a modified from this.

About

Toplevel CMakeLists.txt for developing ROS 2 with Colon and CLion (or other cmake-based IDEs)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published