I have C++ project using cmake. I'd like to have versioning (in meaning of provide unique ./myapp --version output) based on git commits. Manually it's something like 
gcc ... -DVERSION=$(git rev-list|wc -l)
and using VERSION macro if defined in code.
This works as expected. But how should I write it into CMakeLists.txt (let's use echo for simplicity)? How should I escape it?
add_definitions(-DVERSION="$(echo 1)")
 
     
    