In premake 3.7, how do I generate -O0 instead of -O2 for gcc?

320 views Asked by At

It seems that -O2 is always generated unless I specify "optimize-speed" (which results in -O3) or "optimize-size" (which results in -Os) in buildflags. If I specify nothing in buildflags but pass "-O0" into buildoptions the result is "-O2 -O0". The expected result, however, would be just "-O0".

How can I prevent the generation of "-O2" when I pass "-O0" as a custom build option? The documentation mentions nothing relevant.

2

There are 2 answers

0
Rafał Rawicki On BEST ANSWER

Probably there is a method to turn -02 off, but it is not necessarry.

From GCC manpage:

If you use multiple -O options, with or without level numbers, the last such option is the one that is effective.

2
David Grayson On

Try building it in Debug configuration instead of Release?