[Interest] CFLAGS, CXXFLAGS etc. env. variables, qmake and building Qt

René J. V. Bertin rjvbertin at gmail.com
Fri Mar 18 16:32:48 CET 2016


Continuing this discussion under a more appropriate topic so others may chime 
in.

>>> Shouldn't be too hard to generate that file using += instead of a simple = ?
>> 
>> It would just as equally break people's expectations.

>> Autoconf-based configure scripts override the default settings.
> 
> Another thing I'll take your word on, with the caveat outlined above. I've a
> whole collection of wrapper scripts that allow me to build configure/autoconf
> and cmake based projects using hand-picked optimisation options. I think I'd
> have noticed if those options replaced everything set by configure/cmake
> systematically (possibly including all -I options).

To summarise : I'm told that the "normal" way to build Qt with non-standard 
compiler options is to edit qmake.conf, or to "subclass" it. I found another 
workaround is a little bit easier : edit the qmodule.pri file after running 
configure so that QMAKE_*FLAGS= becomes QMAKE_*FLAGS+= .
The whole discussion got started about code that presumably is not built under 
qmake control, btw, but using Makefiles that are generated by configure directly.

I'm not going to make any more hard claims that this is indeed comparable to 
what autoconf/configure buildsystems do. CMake does do something similar, only it 
appends its own options to the user-supplied options rather than the other way 
round.

I do think that appending custom options to default options determined by the 
buildsystem makes sense. It allows you to fine-tune the default, e.g. by using -
O3 (or -Os) that'd override -O2, by adding -g or by using an option like -
march=native. IOW, you can override (=replace) certain options, add new ones, 
but crucial options won't be dropped unless you add one that cancels them 
explicitly.

There's another issue with handling custom compiler options through qmake.conf 
and/or qmodule.pri . Normally, if I configure,build,install a package using 
custom options specified through the environment, I do not by default expect 
those options to be forced upon any and all dependent software. Not if the 
options aren't set in the environment when dependents are built.

In other words, I'd love to see a way to provide additional custom compiler 
options to Qt's configure utility, that'd be used only for building Qt. And an 
equivalent option to tell qmake to take CXXFLAGS etc. as a source of additional 
compiler options, if that isn't already what happens. The latter is probably 
easier to implement than the former (and I'd be happy to take a shot at it if 
someone can give me some pointers where to start looking).

Cheers,
René




More information about the Interest mailing list