[Moved] & [Solved] Finding a proper environment variable
-
I am trying to include a environment variable in the include path, I tried searching in few places like
http://developer.qt.nokia.com/doc/qt-4.8/qmake-variable-reference.html
but I am till not able to get it work,there should be some variable like $${QTTarget} or something which I can get it to work,
INCLUDEPATH += "/../../Sourcecode/Modules"
-
No, My question is like what should i specify the INCLUDEPATH as if i need to reach the project directory and specify a folder to search in,
My concern is if i move the folder to some other PC the path should still look into the project path and some specific folder -
Well, you then have the following options
- "PWD":http://developer.qt.nokia.com/doc/qt-4.8/qmake-variable-reference.html#pwd
- "OUT_PWD":http://developer.qt.nokia.com/doc/qt-4.8/qmake-variable-reference.html#out-pwd
- "PRO_FILE_PWD":http://developer.qt.nokia.com/doc/qt-4.8/qmake-variable-reference.html#pro-file-pwd
[quote author="Kewal" date="1327301387"]My concern is if i move the folder to some other PC the path should still look into the project path and some specific folder[/quote]
Use relative paths. -
Well, what do you actually want to achieve? Can you provide an example, because it seems like I just don't get it (or the problem behind).
If you are referring to file within your source tree just use an relative path (which will start with <code>.</code>, <code>..</code> or a directory name, but never with <code>/</code>). This will work regardless where you move your source tree as it is always relative to it. There is no need to use a qmake / environment variable at all.
If you want to use out-of-source build you will have to use $$PWD, as it refers to the source tree (the directory where the .pro file is placed).
@
INCLUDEPATH += $$PWD/Application/SourceCode
@The path <code>/../../Sourcecode/Modules</code> makes no sense at all, because it is an absolute path, starting at root and getting <code>..</code>'d two times, which results in root again.