Hi

> If that is so, I plan to assign my desired release options to
> CMAKE_CXX_FLAGS_RELEASE and assign that variable to CMAKE_CXX_FLAGS. That way,
> a release build will happen by default (no build type specified) or if
> "Release" is specified. I can handle debug builds using CMAKE_CXX_FLAGS_DEBUG.

Sorry, I have misunderstood. No need to answer.

David

> > -----Original Message-----
> > From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of
> > Michael Hertling
> > Sent: 29 September 2010 02:15
> > To: cmake@cmake.org
> > Subject: Re: [CMake] How to set compiler flags?
> >
> > On 09/28/2010 05:35 PM, David Aldrich wrote:
> > > Hi
> > >
> > > I am writing CMakeLists.txt files for my C++ application. Initially I set
> > the C++ compiler flags by setting CMAKE_CXX_FLAGS:
> > >
> > > set( CMAKE_CXX_FLAGS "-Wall -m64 -O3 " )
> > >
> > > Then I realised that those flags get passed to the linker as well, which
> > seemed a bit untidy. [...]
> >
> > But possibly necessary:
> >
> > <http://www.cmake.org/pipermail/cmake/2010-July/038083.html>
> >
> > et seq.
> >
> > > [...] So I now use add_definitions instead:
> > >
> > > add_definitions( "-Wall -m64 -O3" )
> > >
> > > Is there a better way of doing this?
> >
> > Don't do this at all, and adhere to the flags.
> >
> > > My CMakeLists.txt files only handle a release build currently. If you
> could
> > give me a hint for how to go on to add a debug build option, I would be
> > grateful.
> >
> > Doesn't the DEBUG variant of the flags, e.g. CMAKE_CXX_FLAGS_DEBUG, and
> > other related variables - perhaps in connection with CMAKE_BUILD_TYPE -
> > work for you?
> >
> > Regards,
> >
> > Michael
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> > http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
> >
> >
> >  Click
> >
> https://www.mailcontrol.com/sr/g!Zu+tz8WoHTndxI!oX7Uq0JINmXjwVqUAeEJxkrmVZ0jY
> > kyJOOpuMF6ri4kt+pzfxoBRqvSue5ICd5VsZuQpQ==  to report this email as spam.
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to