bazelbuild / rules_foreign_cc

Build rules for interfacing with "foreign" (non-Bazel) build systems (CMake, configure-make, GNU Make, boost, ninja, Meson)
https://bazelbuild.github.io/rules_foreign_cc
Apache License 2.0
649 stars 232 forks source link

Fix #1161: set the `CMAKE` environment variables for prebuilt toolchains. #1163

Closed thb-sb closed 3 months ago

thb-sb commented 5 months ago

Fix #1161: set the CMAKE environment variables for prebuilt toolchains.

This commit is an attempt to fix #1161 by setting the CMAKE environment variable (through TemplateVariableInfo).

Since the CMake prebuilt packages yield multiple files, we cannot use $(execpath) to get the path to the CMake binary, as we do for Ninja:

https://github.com/bazelbuild/rules_foreign_cc/blob/c2e097455d2bbf92b2ae71611d1261ba79eb8aa8/toolchains/prebuilt_toolchains.py#L449

To circumvent this issue, this commit adds a new attribute called tools to the native_tool_toolchain rule. Through this attribute, extra targets can be passed to _resolve_tool_path in order to be able to expand the path to a single file using $(execpath).

thb-sb commented 3 months ago

up.