[CMake] try using the "-03" option to gcc

Michael Wild themiwi at gmail.com
Wed Dec 23 03:36:14 EST 2009


On 23. Dec, 2009, at 9:22 , Water Lin wrote:

> 
> I am trying to use the "-03" option to gcc. But after I use
> --------------------
> add_definitions(-03)
> --------------------
> 
> in CMakeLists.txt file and generate the Makefile, I make the project and
> gcc provides me a info:
> -----------
> c++: unrecognized option '-03'
> -----------
> 
> How can I add "-03" option by CMakeLists.txt?
> 
> Thanks
> 
> Water Lin

That's because the options is not called -03 ("dash zero three") but -O3 ("dash big-ooh three").

And you shouldn't do that anyways. Rather set the CMAKE_BUILD_TYPE option to "Release" in your cache (NOT the CMakeLists.txt file). E.g. if you're using the command line:

cmake -DCMAKE_BUILD_TYPE=Release /path/to/source

If you're using the graphical interface, just set the variable there (without the quotes).


HTH

Michael




More information about the CMake mailing list