[Interest] Two from one.

Konrad Rosenbaum konrad at silmor.de
Fri Feb 9 09:34:32 CET 2018


On Thursday, 8 February 2018 13:22:12 CET william.crocker at analog.com wrote:
> 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. :-)

The correct statement in this sentence is "bad approach". QMake is designed 
this way - suck it up or chose a different build tool!

BTW: the general direction of most of my projects is to accumulate more 
directories and more project files with all the common stuff in a central .pri 
file. Refactoring for me usually means to split up projects into independent 
libraries that can be more freely combined and more easily tested. 
Modularization isn't popular because it is a cool word, but because it works.

You are not doing yourself any service by insisting on a single directory and 
a single project file - on the contrary you are creating a trap that your 
future self with get sucked into. Good luck! You will need it.

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

For complex projects to have a separate makefile to direct the build process is 
a good idea anyway. But please keep the projects in separate files and if at 
all possible in separate directories. You will thank yourself for this later.

If you don't believe me: please go ahead and try, but plan significant time for 
refactoring a few years from now. I'm sure you'll come to the same conclusions 
that I (and most of us seniors here) did years ago.


	Konrad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180209/6471f48a/attachment.sig>


More information about the Interest mailing list