Qt5. VERSION of lib
-
Hi All
I Have project with TEMPLATE = subdirs. Linux, qmake
ProjBase- ProjBase.pro
- Version.h
- ProjFirst
-- ProjFirst.pro
-- ... - ProjSecond
-- ProjSecond.pro
-- ...
how can i use version.h to set lib version in child projects?
It is necessary that the version changes are in one place and the version of all lib is the sameThanks
-
you add Version.h into ProjFirst.pro and ProjSecond.pro like: $$PWD/../Version.h
-
The C++ header file has nothing to do with the version of libraries that may be linked to your executable artefacts. The linker finds libraries in locations specified in your PRO file LIBS variable or in standard locations (and will use the first library found that provides the symbol it is looking for). If you want to centralise the setting of the LIBS variable (or other qmake variables) then you can include a project file fragment, typically named blah.pri, in each subordinate PRO file.
ProjBase.pro # a subdirs project ProjBase.pri # a shared set of settings Project1 # sub project 1 Project1.pro Project2 # sub project 2 Project2.pro
ProjBase.pri looks like
LIBS += -L/some/path/lib -lblah LIBS += -L/some/other/path/lib -lfoo
Project1.pro or Project2.pro look like
include(../ProjBase.pri) ...
If you are trying to ensure that all the projects are built and linked with the same version of Qt then you achieve this by using the
qmake
from the desired version of Qt. -
thanks for answers
I don't need the QT version, I want to centrally specify the versions of my libraries when they are built.
For example, Version.h looks like this:#ifndef VERSION_H
#define VERSION_H
#define V_VERSION 1.0.0.12
#endifHow do I specify version 1.0.0.12 when building my libraries using this file.
Or what other ways are there to do it? -
V_VERSION is used only on display of the version number in your app.
for your libs define this + build number in cmake or qmake for packaging. And this number can be passed to your app via cmake or qmake variable. Therefore, Version.h may not be needed.