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

William A. Hoffman billlist at nycap . rr . com
Thu, 16 Oct 2003 10:12:58 -0400


I have just checked in a change so that this will work.
It is in CVS, can you give it a try and make sure it does
what you want before we make 1.8.2?  

I have also changed it so that if you add /D_UNICODE to the cxx flags,
it will do the right thing and change the mode.

Thanks.

-Bill


At 12:29 PM 10/15/2003, Mathews, Rob wrote:
>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
>> 
>_______________________________________________
>Cmake mailing list
>Cmake at www . cmake . org
>http://www . cmake . org/mailman/listinfo/cmake