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

headerFileNamestring1.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.
repoDirstring1.10the top-level project directory (project.sourceDirectory)The root directory of the repository.
repoStatestring1.10-The current state of the repository. For instance, in Git this is the commit hash of the current HEAD.
toolFilePathstring1.10the file name of the version control tool corresponding to typeSet 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.
typestring1.10auto-detectedThe version control system used in the project. Currently, the supported values are "git" and "svn".

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