First, let's look at the excerpt from my CMakeLists.txt:
find_package(Qt4 4.8.0 COMPONENTS QtCore QtGui QtOpenGL REQUIRED)
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
Therefore, by default we get the following definitions in Debug mode:
-DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_DLL -DQT_DEBUG
So the first question is: why there are two -DQT_DLL definitions?
Now, if I append, for instance, remove_definitions(-DQT_DEBUG) - nothing changes. In other words, either remove_definitions command is bugged or these definitions are merely carved in stone.
Then I thought like "OK, maybe remove_definitions command is really bugged, let's do it another way." And I did list(REMOVE_ITEM QT_DEFINITIONS -DQT_DEBUG). However, it didn't work either.
Therefore, the second question is: are these definitions really built-in and persistent and cannot be changed under any circumstances?
NOTE: Despite problems with editing these built-in definitions, it is still possible add custom definitions, for instance:
add_definitions(-DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT)
Ok, so here we have several things. It boils down to the
CMakemacros and their logic.Double
-DQT_DLLcomes fromadd_definitions(${QT_DEFINITIONS)}). It is enough to specifyinclude(${QT_USE_FILE}).QT_USE_FILEdefinesQT_DEBUG(orQT_NO_DEBUG) based on the currentCMAKE_BUILD_TYPE. If for whatever reason you don't want to haveQT_DEBUGin theDEBUGmode (and to work withQT_USE_FILE) there might be a way to do that.CMakeputs these specific definitions in the directory properties:Now, you could try tweaking these settings...