Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [Moved] & [Solved] Finding a proper environment variable
Forum Updated to NodeBB v4.3 + New Features

[Moved] & [Solved] Finding a proper environment variable

Scheduled Pinned Locked Moved Qt Creator and other tools
7 Posts 2 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kewal
    wrote on last edited by
    #1

    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"

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      <code>INCLUDEPATH += $$(name_of_environment_variable)</code>

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kewal
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            Kewal
            wrote on last edited by
            #5

            so i tried something like this

            INCLUDEPATH += $$PRO_FILE_PWD(....\Application\SourceCode)

            should i include it in quotes,.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • K Offline
                K Offline
                Kewal
                wrote on last edited by
                #7

                thanks a lot, it worked. I was just messed up with the Quotes

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved