Provides support for version control systems. More...

Since: Qbs 1.10


Detailed Description

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 example:

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

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

Above, 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.

Property Documentation

headerFileName : string

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.

Default: "vcs-repo-state.h"

repoDir : string

The root directory of the repository.

Default: The top-level project directory (project.sourceDirectory).

repoState : string

The current state of the repository.

For example, in Git this is the commit hash of the current HEAD.

Default: Undefined

toolFilePath : string

Set this property 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.

Default: The file name of the version control tool corresponding to type.

type : string

The version control system used in the project.

Currently, the supported values are "git" and "svn".

Default: auto-detected

© 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.