[Interest] Two from one.

Benjamin TERRIER b.terrier at gmail.com
Thu Feb 8 17:54:08 CET 2018


2018-02-08 16:47 GMT+01:00 william.crocker at analog.com <
william.crocker at analog.com>:

>
> 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
}

And then you could build it like so:

    qmake CONFIG+=build_lib
    make
    qmake
    make

BR,

Benjamin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180208/ae246ee0/attachment.html>


More information about the Interest mailing list