[Qt-creator] Theory of Operation question concerning configurations

eike.ziller at nokia.com eike.ziller at nokia.com
Thu May 31 09:39:01 CEST 2012


First of all, qmake documentation is pretty lacking, so no blame on you ;) Especially the CONFIG variable feels pretty magic sometimes, because it mixes several mutually exclusive options, and of these always the last to appear is effective. E.g. (debug, release, debug_and_release) and (static, shared, static_and_shared).
So, CONFIG+= static_and_shared should do your trick (if CONFIG doesn't get a static or shared appended later).

As a side note, if you have two .pro files that would need to use the same source+header files, the "usual" approach is to put the HEADERS and SOURCES sections into a .pri file, and include that in your two .pro files.

foo.pro:
TEMPLATE = subdirs
SUBDIRS+=foo_blah.pro foo_blubb.pro

foo_blah.pro:
include(foo_include.pri)
[... more ...]

foo_blubb.pro:
include(foo_include.pri)
[... more ...]

foo_include.pri:
SOURCES+=$$PWD/source1.cpp $$PWD/source2.cpp
[... more ...]

--
Eike Ziller
Principal Software Engineer

Nokia, Qt Development Frameworks

Nokia gate5 GmbH
Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B
Umsatzsteueridentifikationsnummer: DE 812 845 193
Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori
________________________________
From: qt-creator-bounces+eike.ziller=nokia.com at qt-project.org [qt-creator-bounces+eike.ziller=nokia.com at qt-project.org] on behalf of ext Jonathan S. Shapiro [shap at eros-os.org]
Sent: Thursday, May 31, 2012 01:24
To: Coda Highland
Cc: qt-creator at qt-project.org
Subject: Re: [Qt-creator] Theory of Operation question concerning configurations

That definitely won't work. The .o files for the two types of libraries are typically generated using very different compile options.

On Wed, May 30, 2012 at 12:43 PM, Coda Highland <chighland at gmail.com<mailto:chighland at gmail.com>> wrote:
On Wed, May 30, 2012 at 2:24 PM, Jonathan S. Shapiro <shap at eros-os.org<mailto:shap at eros-os.org>> wrote:
> I understand the solution that uses multiple ".pro" files, but this approach
> doesn't seem to interact happily with QtCreator. What QtCreator sees in this
> case is two projects, with the result that source files need to be added to
> both of them.

You missed my point on the second one -- the second project contains
NO source files but rather only performs linking. Qt Creator should
display this as an empty subproject but I THINK it should still do the
trick -- although you may need to point to the static lib by path in
OBJECTS instead of with a LIBS += -l directive.

/s/ Adam


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20120531/175e02aa/attachment.html>


More information about the Qt-creator mailing list