bazel-contrib / bazel-contrib/rules_foreign_cc

Cannot use @rules_foreign_cc//toolchains:current_cmake_toolchain in genrule

Open
#925 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
737
Forks
270
PR merge metrics
No merged PRs in 30d

Description

I'm attempting to run *only* the generate step of a cmake project, not actually build any targets, in order to generate a file created by `configure_file`. My best guess is I'd do this via a custom genrule, but I'm running into a pretty fundamental issue: `$(CMAKE)` isn't valid in a genrule with @rules_foreign_cc//toolchains:current_cmake_toolchain listed as one of the toolchains. Is this user error? The documentation seems to indicate that this rule is specifically meant for use in genrules.
Using bazel 5.1.1 for reference

Contributor guide

Open the contributing guide

Research direction

Reproduce the custom genrule with Bazel 5.1.1 and @rules_foreign_cc//toolchains:current_cmake_toolchain. Start with the documentation for that toolchain and genrule variable expansion, then compare the documented behavior with the reported $(CMAKE) failure. Done means the generate-only workflow is confirmed and supported, or the limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.