Cmake FLAG - nenetto/CMakeTemplates GitHub Wiki

Templates comes with a CMake flag. This flag control some extra messages from CMake that will appear if it set to TRUE/ON in CMake configuration.

By default is set to TRUE, but if you do not want to use it, just set to FALSE during configuration.

Trick

One cool utility is combine this flag with Config.h file. If you open the autogenerated file, you will see a define like this

// Configuration Variables
#if ${${PROJECT_NAME}_CMAKE_DEBUG}
#define ${MYPROJECT_NAME}_DEBUG_FLAG TRUE
#endif

That means that, if the flag in CMake is set to ON/TRUE/1, a C++ global variable will set to TRUE. You can write debugging messages in your code, and control if they will appear during running using this CMake flag very easily.