Git tools

qi_get_git_version(out)
Arguments:
  • out – Output variable

Get the git version of the current project, using git describe

Example:

# In CMakeLists.txt
qi_get_git_version(git_version)

qi_create_bin(foo "main.cpp")

set_source_files_properties("main.cpp"
  PROPERTIES
    COMPILE_DEFINITIONS "VERSION=\"${git_version}\"")
// in main.cpp
std::cout << VERSION << std::endl;