colcon-cmake is an extension for the colcon build tool, providing robust support for building, testing, and installing packages that utilize CMake as their build system. It seamlessly integrates CMake projects into the colcon workspace management workflow, enabling consistent project orchestration across various build types. The current version is 0.2.29, with releases generally aligned with colcon's development or as required for improvements and bug fixes.
pip install colcon-cmakeNo compatibility data collected yet for this library.
This quickstart demonstrates how to set up a simple CMake package and build it using colcon, leveraging the colcon-cmake extension. Ensure `colcon-cmake` is installed before running `colcon build`.
Ensure your CMake project has a `CMakeLists.txt` in the root of its source directory. For ROS-style packages, add a `package.xml` with `<build_type>cmake</build_type>`.
Always use `colcon build --cmake-args -- <YOUR_CMAKE_ARGS>`. The `--` after `--cmake-args` is crucial to separate `colcon`'s own arguments from those intended for CMake.
Always ensure your `colcon-core` installation meets or exceeds the minimum version required by `colcon-cmake`. Upgrade `colcon-core` if facing unexplainable errors (`pip install --upgrade colcon-core`).
Install `colcon-core` or `colcon-cmake`: `pip install colcon-cmake`. Ensure your Python environment's script directory (e.g., `~/.local/bin` on Linux) is included in your system's PATH.
Verify that `CMakeLists.txt` exists at the root of your package's source directory. If applicable, confirm your `package.xml` contains `<build_type>cmake</build_type>`.
Install the required system dependency (e.g., `sudo apt install libsomedependency-dev`) or ensure your `CMakeLists.txt` correctly locates the dependency.
Use `colcon build --cmake-args -- -DCMAKE_BUILD_TYPE=Release` to correctly pass arguments to CMake.