I have a section of code that conditionally activates depending on #define, for example:
#ifdef VARIABLE code.function(); #endif
The cmake script has the "options" command, which sets the VARIABLE value as follows:
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")
I use cmake to create a project and qtcreator as an IDE. My problem is that qtcreator believes that VARIABLE is not defined, so my code is not highlighted, but when I create it on the console, VARIABLE is detected. So, what parameters should qtcreator pass to run cmake so that it knows that VARIABLE is defined and highlights my code? Is there any way to do this?
Ps: I just use qtcreator to edit files, part of the build is done using console commands.
Salsa source share