title: Executing bash commands from a CMake file
body: <p>I am having trouble understanding CMake. What I want to do is execute the following bash command during the build process:</p>
  
  <p><code>date +"%F %T" &gt; timestamp</code></p>
  
  <p>This fetches the current date and writes it to a file. However, I cannot seem to reproduce this simple action using CMake commands.</p>
  
  <p>Here are a few things that I've tried:</p>
  
  <p><code>execute_process(COMMAND "date +'%F %T' &gt; timestamp")</code></p>
  
  <p><code>add_custom_command(OUTPUT timestamp COMMAND date +"%F %T")</code></p>
  
  <p><code>file(WRITE timestamp date +"%F %T")</code></p>
  
  <p>Neither seem to work. I almost wonder if they are even being executed at all. </p>
  
  <p>I have a very limited knowledge of how CMake and its syntax, so I am probably doing things very wrong. I am hoping someone could point me in the right direction. Thanks!</p>