I have following code:
int main() {
#ifdef COMMIT_VERSION
cout << "app version: " << COMMIT_VERSION << endl;
#endif
}
I would like to invoke cmake such that it passes COMMIT_VERSION variable defined on command line to g++ and thus to my application. E.g. following invocation:
cmake -WHAT_IS_THE_OPTION_NAME COMMIT_VERSION='"Hello Version"'
make
./a.out
produces output
app version: Hello Version