- 1 year ago
Bazel is building executables without .exe extension
By default, Bazel builds executables without a file extension on Windows systems. This behavior is intentional and aligns with the convention in Bazel's target platform-agnostic approach.
However, if you prefer to have the .exe
extension added to the built executables, you can configure Bazel to do so. Here's how you can accomplish this:
Open your Bazel project's
WORKSPACE
file.Add the following line to the
WORKSPACE
file:pythonload("@bazel_tools//tools/build_defs/repo:utils.bzl", "platform")
platform(name = "windows")
Save the
WORKSPACE
file.
This modification explicitly defines the windows
platform in the Bazel workspace, enabling certain platform-specific behaviors.
Once this change is in place, Bazel will automatically add the .exe
file extension to the built executables on Windows systems.
Please note that this modification affects the entire Bazel workspace. Therefore, it will impact all targets built by Bazel in the workspace.