BinaryProbe
Locates executable files outside the project. More...
Inherits: |
- List of all members, including inherited members
- BinaryProbe is part of List of All Items.
Detailed Description
Finds executable files that have the specified file names.
BinaryProbe searches for executable files within directories specified by the PATH environment variable.
Note: On Unix, also searches in the /usr/bin
and /usr/local/bin
directories by default. Override PathProbe.platformSearchPaths to change this behavior.
Note: On Windows, only files that have .com, .exe, .bat, .cmd extensions are considered executables. Override PathProbe.nameSuffixes to change this behavior.
For example, BinaryProbe can be used to search for a protobuf compiler executable as follows:
// Assuming module is called "myproto" import qbs.File import qbs.Probes Module { // search for a protoc executable Probes.BinaryProbe { id: protocProbe names: "protoc" } property string executableFilePath: protocProbe.filePath validate: { if (!File.exists(executableFilePath)) throw "The executable '" + executableFilePath + "' does not exist."; } // use the found executable Rule { // rule input/outputs here... // run executable for the module called "myproto": prepare: { var args = // initialize arguments... var cmd = new Command(input.myproto.executableFilePath, args); cmd.highlight = "codegen"; cmd.description = "generating protobuf files for " + input.fileName; return [cmd]; } } }
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.