title: How do I define a variable when I call CMake, so that qtcreator knows it is defined?
body: <p>I have a section of code that is conditionally activated depending on a #define, like this:</p>
  
  <pre><code>#ifdef VARIABLE
    code.function();
  #endif
  </code></pre>
  
  <p>The cmake script has an 'options' command that sets the VARIABLE like this:  </p>
  
  <pre><code>option(VARIABLE "Want to use VARIABLE?" ON)
  
  if(VARIABLE)
     message(STATUS "VARIABLE")
     set(VARIABLE_FLAG "-DVARIABLE")
  endif()
  
  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VARIABLE_FLAG} -Wall")
  </code></pre>
  
  <p>I'm using cmake to build the project and qtcreator as IDE. My problem is that qtcreator thinks that VARIABLE is not defined so my code has is not highlighted, but when I build it on a console, VARIABLE is defined. So, what parameters should I pass to qtcreator to run cmake, so that it knows VARIABLE is defined and highlights my code? Is there a way to do this?</p>
  
  <p>Ps: I just use qtcreator to edit files, the build part is done via console commands. </p>