Qbs Manual | List of Modules | Module vcs

Qbs 1.10.1

# Module vcs

The `vcs` module provides the current state of the project's repository via the `repoState` property. By default, a `C` header is also generated, allowing for simple retrieval of the repository state directly from within your C/C++ sources. This is useful to embed information into binaries about the exact state of the repository from which they were built. For instance:

      #include <vcs-repo-state.h>
      #include <iostream>

      int main()
      {
          std::cout << "I was built from " << VCS_REPO_STATE << std::endl;
      }

As you can see in the above code, a header file called `vcs-repo-state.h` is created, defining a macro called `VCS_REPO_STATE` which expands to a character constant describing the current state of the repository. For Git, this would be the current HEAD's commit hash.

## Module Properties

Property | Type | Since | Default | Description
--- | --- | --- | --- | ---
headerFileName | string | 1.10 | `"vcs-repo-state.h"` | The name of the C header file to be created. Set this to `undefined` if you do not want a header file to be generated.
repoDir | string | 1.10 | the top-level project directory (`project.sourceDirectory`) | The root directory of the repository.
repoState | string | 1.10 | - | The current state of the repository. For instance, in Git this is the commit hash of the current HEAD.
toolFilePath | string | 1.10 | the file name of the version control tool corresponding to `type` | Set this if the tool has an unusual name in your local installation, or if it is located in a directory that is not in the build environment's `PATH`.
type | `string` | 1.10 | auto-detected | The version control system used in the project. Currently, the supported values are `"git"` and `"svn"`.