[Paraview] Detecting build type in C++ code

Mike Jackson mike.jackson at imts.us
Thu Aug 7 17:13:52 EDT 2008


Here is a copy of CMake's flags for a ParaView build.

  CMAKE_CXX_FLAGS
  CMAKE_CXX_FLAGS_DEBUG            -gdwarf-2
  CMAKE_CXX_FLAGS_MINSIZEREL       -Os -DNDEBUG -DQT_NO_DEBUG
  CMAKE_CXX_FLAGS_RELEASE          -O3 -DNDEBUG -DQT_NO_DEBUG
  CMAKE_CXX_FLAGS_RELWITHDEBINFO   -O2 -gdwarf-2 -DQT_NO_DEBUG

As you can see for a Release build "NDEBUG" is defined so I might try  
the following:

#ifndef (NDEBUG)
	// Debug statements are printed
   std::cout << .... Debug.. blah blah
#else
	 //Really fast release code here.
#endif

Cheers
-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Aug 7, 2008, at 5:08 PM, Chris Cameron wrote:

> Hi,
>
> I'm looking for a cross-platform way of detecting the build type  
> from C++ code.
>
> The idea is that if the code is being compiled for release, that  
> certain testing things we do can be eliminated from the release  
> build of our Paraview.
>
> Something like
>
> #ifdef (CMAKE_RELEASE)
>   // do some stuff
> #else
>   // do other stuff
> #endif
>
> would do the trick. Does anyone know the name of the define that  
> I'm looking for?
>
> -- 
> Chris Cameron
> Mirarco Mining Innovation - e2vo
> 705-675-1151
> x5113
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20080807/291abac3/attachment.htm>


More information about the ParaView mailing list