title: How can I pass git SHA1 to compiler as definition using cmake?
body: <p>In a Makefile this would be done with something like:</p>
  
  <pre><code>g++ -DGIT_SHA1="`git log -1 | head -n 1`" ...
  </code></pre>
  
  <p>This is very useful, because the binary knows exact commit SHA1 so it can dump it in case of segfault.</p>
  
  <p>How can I achieve the same with CMake?</p>