Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

findProgramLazy

Public Function
std.Build.findProgramLazy
pub fn findProgramLazy(b: *Build, options: Step.FindProgram.Options) LazyPath

Creates an anonymous Step that searches for an executable on the host that has more than one possible name.

Returns the LazyPath of the found executable. The search only takes place if the LazyPath will be used by a depending Step.

This API is useful in the following cases:

  • The binary is not named the same across all systems (for example "python" vs "python3").
  • The binary may be produced by building from source rather than being globally installed and will therefore be possibly found in one of the search prefix paths.

Names are searched in order, observing search prefixes first and then PATH environment variable.

Windows file name extensions are searched automatically, respecting the PATHEXT environment variable, so they need not be included in this list. However, even on Windows, the names will be checked without appending extensions first, so that can be used as a priority system.

See also:

Params

File

Build.zig:1598
1598
1599
1600
pub fn findProgramLazy(b: *Build, options: Step.FindProgram.Options) LazyPath {
    return .{ .generated = .{ .index = Step.FindProgram.create(b, options).found_path } };
}