General Setting
My goal is to build smtk (and later, cmb) in Debug. The problem is that cmb-superbuild does not allow Debug builds.
To work around this limitation, I want to build cmb-superbuild in RelWithDebugInfo, while also setting:
-
/MDd /DWIN32compiler flags -
_ITERATOR_DEBUG_LEVEL=0(in the downstream projects, notcmb-superbuild)
As I understand it, this should allow the subsequent build of smtk to be Debug, even though smb-superbuild is built in RelWithDebInfo.
Steps Taken
_ITERATOR_DEBUG_LEVEL
The command line argument -D_ITERATOR_DEBUG_LEVEL=0 does not seem to work, and instead the following line needs to be added to the main CMakeLists.txt file:
add_definitions(-D_ITERATOR_DEBUG_LEVEL=0)
It is unclear to me so far whether it is better to:
- set
_ITERATOR_DEBUG_LEVEL=2incmb-superbuild, or - set
_ITERATOR_DEBUG_LEVEL=0insmtk(and later,cmb)
I have not yet had a chance to test these two options.
/MDd /DWIN32 compiler flags
These compiler flags are set using these cmake commands:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MDd /DWIN32")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /DWIN32")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MDd /DWIN32")
The /MDd does not seem to propagate, and so must be set at every level of cmb-superbuild. So far, these lines of code are added to:
- CMakeLists.txt
- projects\paraview.cmake
- projects\vtk.cmake
- projects\vtkonly.cmake
- projects\win32\moab.cmake
- superbuild\projects\win32\boost.cmake
Problem
For most parts of cmb-superbuild, the above steps work well. However, this fails for VTK within paraview. Specifically, we get hundreds/thousands of compile errors like:
cl : Command line warning D9025 : overriding '/MDd' with '/MD'
I cannot find any other likely locations where I should insert the compiler flags definitions to get past these compile errors.
How can I prevent paraview from overriding my specified flags?