A Bazel Gazelle plugin to generate C++ (cc_library, cc_binary, cc_test) rules from existing CMake projects.
The examples directory contains real-world demonstrations of the gazelle-foreign-cc plugin. The examples directory is a separate Bazel module that references the main plugin using a local path override.
Available examples:
- simple_hello: Basic C++ "Hello, World!" project
- libzmq: Real-world example using ZeroMQ messaging library
To build and test examples:
cd examples
bazel build //...To run gazelle on examples:
cd examples
bazel run //:gazelleThis plugin is under active development. Currently, it can:
- Be built using Bazel.
- Recognize basic C++ source files and generate simple
cc_library,cc_binary, orcc_testrules by convention. - Handle basic configuration directives (e.g.,
gazelle:cmake_executable).
Note: Full CMake CMakeLists.txt parsing and sophisticated dependency resolution are not yet implemented.
- Implement robust parsing of
CMakeLists.txt. - Implement C++ include scanning for dependency resolution.
- Add comprehensive tests for various CMake project structures.
- Bazel
- Go
- A C++ toolchain configured for Bazel
bazel build //gazelle:gazelle-foreign-ccThis project uses Bazel's module system (bzlmod). After making changes to MODULE.bazel, ensure the lock file is up-to-date:
bazel mod tidyThe CI will fail if MODULE.bazel.lock is not synchronized with MODULE.bazel.
(Details to be added once the plugin is more feature-complete)
# Example of how Gazelle is typically run
# bazel run //:gazelle -- path/to/your/cmake_projectThis README is a work in progress and will be updated as the plugin evolves.