How to change optimization level when building?

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
Post Reply
vanfanel
Posts: 97
Joined: Thu Mar 24, 2016 6:04 pm

How to change optimization level when building?

Post 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!
User avatar
Nightfall
Posts: 555
Joined: Thu Aug 06, 2009 4:00 am
Location: Finland

Re: How to change optimization level when building?

Post by Nightfall »

Pass it to the compilation flags, as such:

Code: Select all

cmake <parameters> -DCMAKE_C_FLAGS="-O2" -DCMAKE_CXX_FLAGS="-O2"
vanfanel
Posts: 97
Joined: Thu Mar 24, 2016 6:04 pm

Re: How to change optimization level when building?

Post 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...
Post Reply

Return to “General”