title: How to add definition -DFOO with CMake?
body: <p>I found that I can use:</p>
  
  <pre><code>add_definitions(-DFOO -DBAR ...)
  </code></pre>
  
  <p>Unfortunately this is not a portable solution. If I use gcc, it will understand the <code>-D</code> switch, but If I use another compiler it may not understand that switch. </p>
  
  <p>Is there another solution such as</p>
  
  <pre><code>set(CMAKE_DEFINES ${CMAKE_DEFINES} FOO BAR)
  </code></pre>