[Paraview] Detecting build type in C++ code

Dominik Szczerba dominik at itis.ethz.ch
Thu Aug 7 17:25:00 EDT 2008


You can add a definition equal to the current setting of CMAKE_BUILD_TYPE:

ADD_DEFINITIONS(-DCMAKE_BUILD_TYPE_IS_${CMAKE_BUILD_TYPE}).

Then you can catch if with ifdefs inside the code.
-- Dominik

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

-- 
Dominik Szczerba, Ph.D.
Foundation for Research
on Information Technologies in Society
http://www.itis.ethz.ch


More information about the ParaView mailing list