View Full Version : How to get current dir using qmake?
lni
4th January 2007, 19:47
Hi,
I have a pro file in my local work area, which includes an pri file somewhere else, as in
include( /apps/system/common.pri )
I run the qmake on my local pro file to create a makefile, how can I determine the full path name of the pro file from within the common.pri file?
The $$PWD will return "/apps/system", which is the location of the common.pri file, but I need to know where the pro file is.
Thanks
wysota
4th January 2007, 20:57
You might try reading the path from a variable, like so:
PATHNAME=$$PRO_PATH
and making sure the variable PRO_PATH is defined in the .pro file before you include the .pri file:
PRO_PATH=$$PWD
include(/apps/system/common.pri)
lni
5th January 2007, 21:02
Thanks, that is what I did, but I don't like it.
It requires every pro file to have "PRO_PATH=$$PWD". Is there any other way to determine the caller's location?
I try system( pwd ) inside /apps/system/common.pri, it returns "/apps/system/", which is the same as "PWD" and is not what I am looking for...
wysota
5th January 2007, 21:35
Because it is interpreted in the .pri file. You won't be able to do that without doing the check in the .pro file. I assure you it has benefits :)
camel
7th January 2007, 12:22
Think about not putting it into a pri file but creating a feature (http://doc.trolltech.com/4.2/qmake-advanced-usage.html#adding-new-configuration-features).
I have a rather nice setup involving a ".qmake.cache" and features...
Check it out:template.tar.bz2 (http://www.thecamel.de/template.tar.bz2)
Not yet well documented...but contains some stuff which might be interesting for the wiki...perhaps when I have some time ;-)
camel
7th January 2007, 21:47
And, just in case you were interested in a straight answer instead of the "do you really need that what you ask for" answer I gave you above:
Check out
$$_PRO_FILE_PWD_
or
$$OUT_PWD
Not nice, nor documented and I have only checked to see it is in 4.2.2 but this (or rather one of these, depending of use-case) seems to be what you asked for ;-)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.