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

Water Lin WaterLin at ymail.com
Wed Dec 23 03:56:48 EST 2009


Michael Wild <themiwi at gmail.com> writes:

> 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

Do you mean that if I set -DCMAKE_BUILD_TYPE=Release, I will get the -O3
option?

I tried it, it seems work that way. But while I run my code, it will get
a segmentation fault.

Is this the correct way?

Thanks

Water Lin
>
> If you're using the graphical interface, just set the variable there (without the quotes).
>
>
> HTH
>
> 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

-- 
Water Lin's notes and pencils: http://en.waterlin.org
Email: WaterLin at ymail.com
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the CMake mailing list