title: How to build a program with 2 different values of a variable in CMake
body: <p>I've recently ported my <code>Qt</code> project from <code>qmake</code> to <code>CMake</code>.
  My main program contains a value which depends on a <code>#define</code> directive.</p>
  
  <p>I want to specify that define directive externally via <code>CMake</code> and build 3 differently named versions of the same executable.</p>
  
  <p>How should I do it? </p>
  
  <p>I've seen <code>set_target_properties</code> but this only works for libraries and not for executables.</p>
  
  <p>For example I want that the following program, </p>
  
  <pre><code> int main()
   {
  
      cout &lt;&lt; BUILDTYPE &lt;&lt; endl;
   }
  </code></pre>
  
  <p>it's compiled in 3 different flavors (3 executables) based on the <code>BUILDTYPE "define"</code>
  For example in my <code>CMakeLists.txt</code> I want to specify</p>
  
  <pre><code>add_executable(myAppV1 -DBUILDTYPE=1)
  add_executable(myAppV2 -DBUILDTYPE=2)
  add_executable(myAppV3 -DBUILDTYPE=3)
  </code></pre>
  
  <p>but this is not the correct syntax.
  Some hint?
  and I get 3 executables which prints</p>