Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Get global variable in *.pro file. How?
Forum Updated to NodeBB v4.3 + New Features

Get global variable in *.pro file. How?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 661 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.
  • B Offline
    B Offline
    bogong
    wrote on last edited by bogong
    #1

    Hello all!

    I need to use global variable from system environment in *.pro file. How to do it correctly?
    Something like this:

    DESTDIR = $$(A_PREBUILT_LIBS_ROOT)
    PRI_FILE = $$DESTDIR/file.pri
    include($$PRI_FILE)
    message(Pri file dir $$DESTDIR)
    

    How to get A_PREBUILT_LIBS_ROOT from system environment?
    For now I see this:

    Project MESSAGE: Pri file dir
    

    The example from documentation

    DESTDIR1 = $$(PWD)
    message(The project will be installed in $$DESTDIR1)
    

    Doesn't work either, I see this:

    Project MESSAGE: The project will be installed in
    
    1 Reply Last reply
    0
    • B Offline
      B Offline
      bogong
      wrote on last edited by
      #2

      The default project from Qt Creator and examples from documentation doesn't work at all

      Screenshot 2020-12-12 at 11.25.45.png

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bogong
        wrote on last edited by
        #3

        Issue solved. Solution found.
        For me works only this:

        DESTDIR = $$system(echo $A_PREBUILT_LIBS_ROOT)
        

        And in the project build environment set this:

        Screenshot 2020-12-12 at 11.36.06.png

        kshegunovK 1 Reply Last reply
        0
        • B bogong

          Issue solved. Solution found.
          For me works only this:

          DESTDIR = $$system(echo $A_PREBUILT_LIBS_ROOT)
          

          And in the project build environment set this:

          Screenshot 2020-12-12 at 11.36.06.png

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          Is $$(A_PREBUILT_LIBS_ROOT) not working?

          https://doc.qt.io/qt-5/qmake-language.html#variable-expansion

          To obtain the contents of an environment value when qmake is run, use the $$(...) operator

          Read and abide by the Qt Code of Conduct

          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