[Qt-interest] qmake: suppress version number from library name?

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Wed Jan 5 14:49:10 CET 2011


On 2011-01-05 ITS-CMT-SL-SFR-FIN-DEV Knoll Oliver, ITS-CMT-SL-SFR-FIN-DEV wrote:

> > ...
> And yes, I want to avoid writing LIBS += ...-lFoo1, because that would require me
> later on to manually edit all my *.pro files when I would go to VERSION=2.0.0 - I
> am lazy, I don't want that ;)

Just crossed my mind: I would also change the file names in my WiX based Windows Installer script *.wxs each time I change the major version.

Agreed, that doesn't happen too often, but would be another argument for having no version numbers in DLL/shared object names (at least on Windows), at least for application libraries.

But for the time being I really do now:

VERSION=1.2.3

VERSIONS = $$split(VERSION, ".")
VERSION_MAJ = $$member(VERSIONS, 0)
VERSION_MIN = $$member(VERSIONS, 1)

...

LIBS+= -L/path/to/directory -lFoo$${VERSION_MAJ}

So the library is called Foo1.dll and the application (and other DLLs) link properly against Foo1.dll

Inspired by http://www.qtcentre.org/threads/17984-qmake-how-to-extract-number-from-variable, because I don't know how to use the qmake variable VER_MAJ.

Oh, and I just stumbled across http://bugreports.qt.nokia.com/browse/QTBUG-3133: "Variables such as VER_MAJ should use the VERSION variable to get the relevant info if set if the specific one isn't"

So apparently that is "by design" that one has to explicitly set VER_MAJ ...

Ups again, I just saw that this one is "closed" and the comment sais: "old bug, please report again if still valid". This suggests that VER_MAJ should really contain the major version, as set in VERSION, no?

So it seems that this bug popped up again somewhere between 4.4.3 and 4.7.1 


Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22





More information about the Qt-interest-old mailing list