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. Accessing qmake DESTDIR variable in code

Accessing qmake DESTDIR variable in code

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 768 Views
  • 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.
  • btseB Offline
    btseB Offline
    btse
    wrote on last edited by
    #1

    Hey,

    I was wondering if there's anyway to access the qmake DESTDIR variable in my C++ code.

    I'm currently defining my own macro using this variable, but wanted to know if there's a built in Qt way:
    DEFINES += DEST_DIR=\\\"$${DESTDIR}\\\"

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi,

      No there's not except the way you do it.

      Why do you need that value in your code ?

      Edit: you could generate a header file with the content of that variable but better understand your need before doing that.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      4
      • btseB Offline
        btseB Offline
        btse
        wrote on last edited by
        #3

        We place all of our compiled libs and apps in our own custom dir, rather than having them spread across each individual lib/project folder.

        We also have a plugin architecture, and plugins are placed in a plugins dir inside the above referenced dir.

        These plugins are shared across a bunch of different apps. So when I load the plugins in our app code, I want to be able to find the plugins subdir to load from. Note that this is only for development. When generating Mac dmg bundles, we deal with pulling these plugins into the bundle.

        Am I approaching this incorrectly?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @SGaist said in Accessing qmake DESTDIR variable in code:

          Why do you need that value in your code ?

          Esp. since it can be overwritten during make install...

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            In that case, you should rather structure your DESTDIR content to match more closely the final output when packaging your application.

            That way, you don't have to do special handling in your code. Just in your project management.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            2
            • btseB Offline
              btseB Offline
              btse
              wrote on last edited by
              #6

              Ok, I will try to restructure our stuff towards that, but I don't want to impact other developers too much, plus this is how they've been doing it forever.

              For now it seems my method is working OK.

              Thanks for the help.

              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