title: Compile date and time using cmake
body: <p>I want to use cmake to set VERSION to a release version in case of release builds and to the compile time otherwise.</p>
  
  <p>When using make for development builds, obtaining the compile time was easy via</p>
  
  <pre><code>-DVERSION=`date +%Y-%m-%d_%H:%M`
  </code></pre>
  
  <p>which could be used straight forward by c/c++ source code. Unfortunately, I haven't found out how the same can be achieved when using cmake.</p>
  
  <pre><code>string(TIMESTAMP VERSION "%Y-%m-%d %H:%M")
  add_definitions(-DVERSION="${VERSION}")
  </code></pre>
  
  <p>sets VERSION to the time cmake was executed. How can I set VERSION to the compile time when using cmake (to avoid having to fiddle with <code>__DATE__</code> and <code>__TIME__</code> in the absence of a RELEASE flag)?</p>