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. Qmake "target" variable
Forum Updated to NodeBB v4.3 + New Features

Qmake "target" variable

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

    I have to deploy the binaries of a Qt library project twice - in /usr/lib and in other folder accessed by other clients of the library.

    I use the "make install" for deploying the binaries of the library in /usr/lib by:
    @
    target.path = /usr/lib
    INSTALLS += target
    @

    Now, to make the binaries deploy in another folder I tried the following options, none of which worked:
    Tryout 1:
    @
    target.path = /usr/lib
    INSTALLS += target

    add the "target" variable twice

    target.path = /home/<user>/common/lib
    INSTALLS += target
    @

    Tryout 2:
    @
    #tried to tell qmake to deploy the "target.files" to both folders
    target.path = /usr/lib /home/<user>/common/lib
    INSTALLS += target
    @

    One interesting thing to note is that one sets the "target.path":http://qt-project.org/doc/qt-4.8/qmake-variable-reference.html#installs but the target.files is empty. It seems that qmake "implicitly" knows what to copy to the provided "path". One interesting thing to note in the link provided above is that the sample code there:
    @
    target.path += $$[QT_INSTALL_PLUGINS]/imageformats
    INSTALLS += target
    @

    ... uses "target.path += ..." not "target.path = ..." statement. It seems logically correct to be able to specify multiple destination folders, since you are able to specify multiple source ones.

    The question: how to distribute the target.files to more than one directory?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Create 2 target variables:
      @
      target.path += bla/
      second.path += secondBla/
      INSTALLS += target second
      @

      I don't know if that would work, though. You can also add custom script to QMAKE_POST_LINK and copy the target inside the script.

      (Z(:^

      1 Reply Last reply
      0
      • napajejenunedk0N Offline
        napajejenunedk0N Offline
        napajejenunedk0
        wrote on last edited by
        #3
        1. How to create second target? Isn't it quite a workaround solution (having side effects)?
        2. Adding a script that copies the binaries inside the QMAKE_POST_LINK will require to run "make", so that to build the project, as sudo. I want to run only "make install" as sudo, so that to redistribute the already built binaries.
        3. Is there a way to get all "installable" binaries that "target" knows of?
        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Ad. 1. See my snippet. As I've said, it might be wrong, qmake can be nasty at times.
          Ad. 2. OK then, that can be a problem. You can investigate usage of other build systems here: cmake, scons, qbs.
          Ad. 3. AFAIK, target.path is a simple variable, it does not know about anything. That is why I proposed to create another one ("second.path") in my snippet above.

          (Z(:^

          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