Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: hobbes1069 on September 22, 2012, 01:43:19 PM

Title: How to control CFLAGS in linux?
Post by: hobbes1069 on September 22, 2012, 01:43:19 PM
I've got a test package building of 2.6 but I need to fix a problem before I can start builds for Fedora/RPM Fusion.

I'm already using CMAKE_RELEASE_TYPE=RelWithDebInfo and cmake is honoring the required C/CXX flags that Fedora requires but it's still adding -O3 after the Fedora flags which contain (and require) -O2.

I know cmake already includes system specific build flags but I can't quite find where these are being generated. Any ideas?

Thanks,
Richard
Title: Re: How to control CFLAGS in linux?
Post by: mean on September 22, 2012, 03:23:09 PM
export CFLAGS=xxx does not work ?
Else
cmake -DCMAKE_C_FLAGS=xxxxx or similar should work
Title: Re: How to control CFLAGS in linux?
Post by: hobbes1069 on September 22, 2012, 08:06:59 PM
Exporting works, I guess what I'm trying to say that the internal flags are overriding my flags, i.e. I'm specing -O2 but later in the list of options I'm seeing -O3. I assume the last flag wins?

Richard
Title: Re: How to control CFLAGS in linux?
Post by: mean on September 23, 2012, 06:46:44 AM
yes, the last flag wins
Title: Re: How to control CFLAGS in linux?
Post by: mean on September 23, 2012, 06:49:25 AM
Assuming you are building in release mode
adding
cmake -DCMAKE_C_FLAGS_RELEASE="-O2" -DCMAKE_CXX_FLAGS_RELEASE="-O2" xxxx
should do it
Title: Re: How to control CFLAGS in linux?
Post by: hobbes1069 on September 26, 2012, 05:19:53 PM
I'll keep working on this... As much as I like cmake in general, this is one of the areas that can be very frustrating.

Trying "cmake --system-information" I get the following:
...
CMAKE_CXX_FLAGS == ""
CMAKE_CXX_FLAGS_DEBUG == "-g"
CMAKE_CXX_FLAGS_MINSIZEREL == "-Os -DNDEBUG"
CMAKE_CXX_FLAGS_RELEASE == "-O3 -DNDEBUG"
CMAKE_CXX_FLAGS_RELWITHDEBINFO == "-O2 -g"

CMAKE_C_FLAGS == ""
CMAKE_C_FLAGS_DEBUG == "-g"
CMAKE_C_FLAGS_MINSIZEREL == "-Os -DNDEBUG"
CMAKE_C_FLAGS_RELEASE == "-O3 -DNDEBUG"
CMAKE_C_FLAGS_RELWITHDEBINFO == "-O2 -g"
...

Which tells me that my "-DCMAKE_RELEASE_TYPE=RelWithDebInfo" should be doing the job... unless it's being overriden somewhere...

Thanks,
Richard
Title: Re: How to control CFLAGS in linux?
Post by: hobbes1069 on September 26, 2012, 09:06:33 PM
Ok, getting closer. It looks like it's only ffmpeg that's building with -O3...

Richard
Title: Re: How to control CFLAGS in linux?
Post by: mean on September 27, 2012, 06:06:59 AM
from memory, one of the ffmpeg file does not like to be compiled with -O2
You'll run out of registers or something