[CMake] Question about getting git branch name.

Steven Truppe workbench at gmx.at
Sat Jun 8 18:25:25 EDT 2019


Hi everyone,

i want to have code lines like:

#define BUILD_VERSION

and the BUILD_VERSION should be the name of the actual branch the code
was compiled with, this way i can create a branch for each version and
name it like 0.1 so each version i'm using for release is an own branch.

I found many examples that shows me the branch name (like git status)
but i don't know a way to get only the name of the current branch so i
can for example execute_process to get the revision number into a
variable and then use add_definition(..) to add it as a compile definition.


best regards!



More information about the CMake mailing list