[Qt-interest] How does QtCreator parse the .pro file
Vannoote, Frederik
frederik.vannoote at barco.com
Wed Sep 7 14:26:07 CEST 2011
My pri files are written like that, but the pro file isn't, mainly because QtCreator does that for us. The pri files are maintained by hand.
Is there a way to let QtCreator do this?
Kind regards,
Frederik
Frederik Vannoote
Sr.Development Engineer Software
Barco nv
Pres.Kennedypark 35
B-8500 Kortrijk (Belgium)
-----Original Message-----
From: Bo Thorsen [mailto:bo at sonofthor.dk] On Behalf Of Bo Thorsen
Sent: woensdag 7 september 2011 13:46
To: Vannoote, Frederik
Cc: qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] How does QtCreator parse the .pro file
Den 07-09-2011 13:32, Vannoote, Frederik skrev:
> Hi all,
>
> I'm using QtCreator as IDE. My application has next to the sources also
> some unit tests using QTestLib.
>
> My goal is to be able to debug and step through the classes when running
> a unit test.
>
> This is my directory structure:
>
> -source
>
> oproject.pro
>
> ocomponents
>
> §comp1.pri
>
> §comp2.pri
>
> osome other classes
>
> -tests
>
> ounittests.pro
>
> From the unittests.pro I want to include the project.pro. I do this
> using the regular include(../source/project.pro) statement. However the
> paths are not correct. To cover that, I prepend ../source to them using
> some qmake functions.
>
> At this point that is working fine. I can compile my unittests using the
> command line.
>
> However, when included in QtCreator, it only lists the .pri and .pro
> files without the headers and sources.
>
> Due to that, my code completion don't work, nor can I put breakpoints.
>
> How can I overcome this?
>
> Is this the correct approach to do these kind of things?
You have to do two things:
In the .pri file, do this:
SOURCES += \
$$PWD/file.cpp ...
Always use the $$PWD in included pri files from other directories
Usually, I place the directories as subdirs of the one that hold the
.pro file(s) because then I can use #include "subdir/file.h". If you
prefer, you can add the subdirs to the include path by adding
INCLUDEPATH += $$PWD
in the .pri file.
One final thing: You *can not* have two files with the same names in
different directories when you are using pri files as subprojects
because the generated .o files are all placed in the same directory.
Bo Thorsen,
Fionia Software.
--
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
DISCLAIMER:
Unless indicated otherwise, the information contained in this message is privileged and confidential, and is intended only for the use of the addressee(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message and/or attachments is strictly prohibited. The company accepts no liability for any damage caused by any virus transmitted by this email. Furthermore, the company does not warrant a proper and complete transmission of this information, nor does it accept liability for any delays. If you have received this message in error, please contact the sender and delete the message. Thank you.
More information about the Qt-interest-old
mailing list