Page 1 of 1

How to change optimization level when building?

Posted: Wed Aug 03, 2016 4:49 am
by vanfanel
Hi,

I'm trying to do a release build with a O2 optimization level instead of the default O3 that a release build will have. I know it's more a CMake question than a ZDoom question, but since it's what I am trying to build...

Thanks!

Re: How to change optimization level when building?

Posted: Wed Aug 03, 2016 11:26 am
by Nightfall
Pass it to the compilation flags, as such:

Code: Select all

cmake <parameters> -DCMAKE_C_FLAGS="-O2" -DCMAKE_CXX_FLAGS="-O2"

Re: How to change optimization level when building?

Posted: Wed Aug 17, 2016 10:06 am
by vanfanel
Thanks, nightfall, but while this adds the "-O2" flag, the "-O3" flag is also present because of the "-DCMAKE_BUILD_TYPE=Release" cmake parameter...