
Originally Posted by
marcvanriet
When you use wwWidgets and when you put CONFIG+=wwwidgets in your .pro file, you don't have to provide any paths. Libraries and header files are installed in the appropriate directories when you (n)make install wwWidgets.
The paths are provided in the feature file.
Where should the output go ?
Wherever you want as long as you provide appropriate paths to all the projects using your library. I'm not sure putting wwWidgets in Qt dir was the proper approach but at the time I didn't know any other good solution. I guess now I could install it anywhere and patch the prf file.
wwWidgets uses the 'copy' approach.
Not really. It installs the headers in its own directory. And it's just an apriori decision that this directory is inside Qt's tree. It doesn't matter where you put the files as long as you provide proper paths for all the projects.
Well... this doesn't say anything about the keywords like QMAKE_PRL_BUILD_DIR that you see in most files.
Unless you're using prl files, this directive is of no use to you.
Do you mean you can put anything in a prf like you would put in a pro or pri file ?
Yes, as long as you understand the execution order of entries.

Originally Posted by
high_flyer
But these paths ARE set, and ARE needed.
Agreed.
I don't know if qtAddLibrary() is documented or not, but as wwWidgets is written by wysota, it just might be! :-)
qtAddLibrary() is not documented. I found it while roaming Qt source code.
@wysota - does your install actually sets PATH?
No. The important part is that it dumps a feature (prf) file inside $QTDIR/mkspecs/features. The file contains all the paths that are required for linking the library. You could as well have a pri file that you would include in all project files using the library. And I suggest one does that if he doesn't feel comfortable with prf files, those are tricky. At our company we use prf files for all libraries and projects we have but we don't store them in Qt tree. Instead we have our own directory that is passed to QMake using qmake -set or by setting environment variables. Sadly, recent versions of Qt Creator have trouble discovering those files in certain cases. We even provided a patch to one of previous versions of Creator so it used to work for a while, but now the Trolls have broken it again 
Here is an example of a project file we use:
# qcms.pro
load(arise)
CONFIG += no_link_qcms qcms
TARGET = $$shlibname(qcms)
HEADERS += ...
SOURCES += ...
DEFINES += BUILD_QCMS
win32:installLib($$TARGET)
# qcms.pro
load(arise)
CONFIG += no_link_qcms qcms
TARGET = $$shlibname(qcms)
HEADERS += ...
SOURCES += ...
DEFINES += BUILD_QCMS
win32:installLib($$TARGET)
To copy to clipboard, switch view to plain text mode
with qcms.prf:
load(arise)
createLibrary(qcms, qcms, qcms)
CONFIG += activemq installlib
load(arise)
createLibrary(qcms, qcms, qcms)
CONFIG += activemq installlib
To copy to clipboard, switch view to plain text mode
and arise.prf:
load(arisefunctions)
#CONFIG += personal
ARISEDIR = $${PWD}/../..
ARISESRC = $$ARISEDIR/trunk
ARISEBIN = $$ARISEDIR/bin
ARISELIB = $$ARISEDIR/lib
ARISECONFIG = $$ARISEDIR/config
ARISELIBSCONFIG = $$ARISECONFIG/common
ARISE3RDPARTY = $$ARISEDIR/3rdparty
load(personal)
QMAKE_LIBDIR += $${ARISELIB}
LIBS += -L$$ARISELIB
CONFIG += arisehelp
load(arisefunctions)
#CONFIG += personal
ARISEDIR = $${PWD}/../..
ARISESRC = $$ARISEDIR/trunk
ARISEBIN = $$ARISEDIR/bin
ARISELIB = $$ARISEDIR/lib
ARISECONFIG = $$ARISEDIR/config
ARISELIBSCONFIG = $$ARISECONFIG/common
ARISE3RDPARTY = $$ARISEDIR/3rdparty
load(personal)
QMAKE_LIBDIR += $${ARISELIB}
LIBS += -L$$ARISELIB
CONFIG += arisehelp
To copy to clipboard, switch view to plain text mode
We can even override (per developer or rather per machine) most variables by dumping a .pri file in a certain directory (handled by load(personal)), for instance I store sources in $$ARISEDIR/src and not $$ARISEDIR/trunk, thus witek.pri looks like this:
ARISESRC=$$ARISEDIR/src
QTPROPERTYBROWSERDIR=/home/wysota/Dokumenty/praca/arise/3rdparty/qtpropertybrowser
unset(OQDL)
# do QCms:
LIBS += -L/usr/local/libs
INCLUDEPATH += /usr/local/include/activemq-cpp-3.2.3
CONFIG += rpath_libdirs
QUICKFIX_INCLUDES_DIR = $$ARISEDIR/3rdparty/quickfix/include
ARISESRC=$$ARISEDIR/src
QTPROPERTYBROWSERDIR=/home/wysota/Dokumenty/praca/arise/3rdparty/qtpropertybrowser
unset(OQDL)
# do QCms:
LIBS += -L/usr/local/libs
INCLUDEPATH += /usr/local/include/activemq-cpp-3.2.3
CONFIG += rpath_libdirs
QUICKFIX_INCLUDES_DIR = $$ARISEDIR/3rdparty/quickfix/include
To copy to clipboard, switch view to plain text mode
Line #1 effectively overrides an entry from arise.prf (ARISESRC) while retaining all other values relative to this variable defined in statements that are executed after load(arise). Line #6 adds a library search path for every project I (and only I) build.
But as I said, this IS complicated. For simple projects I would strongly advise against using such things. If you want a simpler setup, make a .pri file for every library you use, dump them in a well known directory and include them in your projects.
Bookmarks