Invoking Bazel Build from Cmake

Skip to first unread message

Suet-fei Li

Aug 25, 2021, 6:25:39 PM8/25/21
to bazel-discuss

I am working on open sourcing a project on Github so it is accessible to external developers and 3rd party partners.

Our code has many external dependencies, some only support Bazel, some only support Cmake, some only support GN. I was able to build the code with Bazel by using rules_foreign_cc to build cmake dependencies from source.

Since it is highly likely our 3rd party partners which are interested in integrating only support cmake, my question is: Is there an well-established way for a top-level project in cmake to build sources that use Bazel (kind of like rules_foreign_cc in reverse)?

I would think someone must have tried doing this and any insight and experience sharing will be greatly appreciated.

zhang kai

Jul 5, 2022, 2:34:18 AMJul 5
to bazel-discuss
We use ` add_custom_target` to build sources with bazel in a CMake project. The main problem with this is that dependecies of this bazel target won't be passed to cmake targets.
Reply all
Reply to author
0 new messages