[Cmake] Setting different compiler flags for Debug vs Release builds

Mathews, Rob rmathews at envoyww . com
Wed, 15 Oct 2003 12:29:53 -0400


Unfortunately this doesn't work.

SET(CMAKE_CXX_FLAGS_RELEASE "/MT" CACHE STRING "runtime-library flags" FORCE
)
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd"  CACHE STRING "runtime-library flags" FORCE
)
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT"  CACHE STRING "runtime-library flags"
FORCE )
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd"  CACHE STRING "runtime-library
flags" FORCE )

and variants thereof don't work either. I can see in the CMake source
generator where the CMAKE_CXX_blah_blah variables are referenced - but the
compiler flags just doesn't appear in the resulting .VCPROJ file. 

.NET 2003 target, CMake 1.8.1

Rob.


> -----Original Message-----
> From: Mathews, Rob [mailto:rmathews at envoyww . com]
> Sent: Tuesday, October 14, 2003 6:27 PM
> To: 'Kevin Wright'; cmake at public . kitware . com
> Cc: James, Ron
> Subject: RE: [Cmake] Setting different compiler flags for Debug vs
> Release builds
> 
> 
> Thanks, that's what I needed to know!
> 
> Rob.
> 
> > -----Original Message-----
> > From: Kevin Wright [mailto:Kevin . Wright at ansys . com]
> > Sent: Tuesday, October 14, 2003 5:33 PM
> > To: cmake at public . kitware . com
> > Subject: RE: [Cmake] Setting different compiler flags for Debug vs
> > Release builds
> > 
> > 
> > > How do you set different compiler flags for Debug vs 
> > Release builds? 
> > > 
> > > For example, I need to set the "/MTd" (use multithreaded 
> > > static debug C
> > > runtime library switch) for a debug build and "/MT" compiler 
> > > flag for a
> > > release build.
> > > 
> > > I've read through the documentation and examples, but 
> > CMAKE_CXX_FLAGS
> > > doesn't seem to support this and I can't find any other magic 
> > > variables. 
> > 
> > I don't know what version this started, but on 1.8 there are 
> > variables for
> > CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE.  Are you using 
> > a different version?
> > 
> > Kevin.
> > _______________________________________________
> > Cmake mailing list
> > Cmake at www . cmake . org
> > http://www . cmake . org/mailman/listinfo/cmake
> > 
> _______________________________________________
> Cmake mailing list
> Cmake at www . cmake . org
> http://www . cmake . org/mailman/listinfo/cmake
>