make qmake honour $RPM_OPT_FLAGS

Kevin Kofler kevin.kofler at chello.at
Thu Oct 18 21:18:19 UTC 2007


Till Maas <opensource <at> till.name> writes:
> when one wants to make sure that a package, that uses qmake(-qt4) to build 
its 
> Makefile, honours $RPM_OPT_FLAGS, waht is the best method?
> 
> Is e.g. the following good? (It's in example for vym):
> qmake-qt4 INSTALLDIR=%{buildroot}%{_prefix} \
> QMAKE_CFLAGS="%{optflags}" \
> QMAKE_CXXFLAGS="%{optflags}" \
> QMAKE_LFLAGS="%{optflags}"

IMHO the .pro file should be fixed to take CXXFLAGS from the environment (and 
use sane defaults if the environment defines nothing), e.g. like this:

isEmpty(CXXFLAGS) {
  CXXFLAGS = $$(CXXFLAGS)
}
isEmpty(CXXFLAGS) {
  debug {
    CXXFLAGS = -Os -g
  } else {
    CXXFLAGS = -Os -s -fomit-frame-pointer
  }
}
QMAKE_CXXFLAGS_DEBUG = $$CXXFLAGS -Wno-non-virtual-dtor $$PKGCONFIG_CFLAGS
QMAKE_CXXFLAGS_RELEASE = $$CXXFLAGS -Wno-non-virtual-dtor $$PKGCONFIG_CFLAGS

(This example, taken from a real program, also shows how to add mandatory flags 
after the ones from the environment.) Then all you have to do is set CXXFLAGS 
like with autotools-based programs.

        Kevin Kofler




More information about the fedora-devel-list mailing list