[Interest] Two from one.

william.crocker at analog.com william.crocker at analog.com
Thu Feb 8 19:22:12 CET 2018


>
>     My goal is to keep all files in the same directory and all .pro logic in the
>     same file.
>     QMake should be ashamed of itself.
>
>
> Why? It is a design decision made by the people who made qmake to have 1 .pro
> file per major target.
> The most obvious evidence is the `TEMPLATE` variable in pro files.
> Whether or not it is a good design can be debated, but I do not see any reason
> to be ashamed of.
> It is like saying that Java should be ashamed of itself because you can only
> have 1 public class per file.
> Anyway we could also debate whether having multiple target of multiple TEMPLATE
> type in a single pro file is a good idea or not.
>
> A bad solution to your problem would be to use CONFIG.
> In your .pro you would have:
>
> build_lib {
>      TEMPLATE = lib
> } else {
>      TEMPLATE = app
>      SOURCES += main.cpp
> }
>

If I create a separate .pro file for lib and main,
I would then have to create yet a third file
to hold the common lines for inclusion in those first
two. That is not moving in the right direction.

The bad approach you suggest above is exactly what
I am looking for. :-)

> And then you could build it like so:
>      qmake CONFIG+=build_lib
>      make
>      qmake
>      make

No problem. Those commands would go in
my (non .pro created) makefile.
All I ever have to do is type: make

Bill



More information about the Interest mailing list