Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [SOLVED]Multi-destinations for Qt project

    General and Desktop
    3
    9
    2028
    Loading More Posts
    • 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.
    • M
      mbnoimi last edited by

      Howdy,

      How can I set multi-destinations option for Qt project?

      I tried to use the following in .pro file but it just execute the first destination only!
      @DESTDIR += ./installer
      DESTDIR += ./bin@

      1 Reply Last reply Reply Quote 0
      • C
        ChrisW67 last edited by

        What are you expecting to achieve with this? Your linker can only output to a single location anyway.

        1 Reply Last reply Reply Quote 0
        • M
          mbnoimi last edited by

          bq. What are you expecting to achieve with this? Your linker can only output to a single location anyway.

          I want to copy my application's binary to many paths this ease deplyment process.

          P.S. I can use system() but don't want to write 3 system functions for each operating system (specially I'm not Windows & Mac user)

          1 Reply Last reply Reply Quote 0
          • C
            code_fodder last edited by

            Not sure you can re-direct to more then one destination, but you can add copy steps to the post link stage (which is effectively the same thing!)

            In your case something like:
            @QMAKE_POST_LINK += cp ./installer/* ./bin@

            Or for windows:
            @QMAKE_POST_LINK += copy ./installer/* ./bin@

            (I think... I am not on my code machine so syntax might be a little out!, try the command first in a terminal/dos promt)

            1 Reply Last reply Reply Quote 0
            • C
              code_fodder last edited by

              oh yeah... only one annoying thing about that is if you have not changed any source code the compile/link stage never occurs and therefore the QMAKE_POST_LINK commands are never run.

              I have not found a way to do commands all the time regardless of linker stage. So when I want to force the issue I either re-build all, or modify a file comment...

              (edit: that line goes into your .pro file ... I think I did not mention that) :)

              1 Reply Last reply Reply Quote 0
              • M
                mbnoimi last edited by

                [quote author="code_fodder" date="1371809569"]Not sure you can re-direct to more then one destination, but you can add copy steps to the post link stage (which is effectively the same thing!)

                In your case something like:
                @QMAKE_POST_LINK += cp ./installer/* ./bin@

                Or for windows:
                @QMAKE_POST_LINK += copy ./installer/* ./bin@

                (I think... I am not on my code machine so syntax might be a little out!, try the command first in a terminal/dos promt)[/quote]

                As I mentioned above, this solution not what I'm looking for because I don't want to call different commands for each operating system. I'm looking for a real cross-platform solution.

                1 Reply Last reply Reply Quote 0
                • C
                  code_fodder last edited by

                  well... its really not a huge effort :o

                  somthink like:

                  windows {
                  QMAKE_POST_LINK += copy ./installer/* ./bin
                  }
                  linux {
                  QMAKE_POST_LINK += cp ./installer/* ./bin
                  }

                  most multi platform projects have some things that are different and you need a few if's and but's.... This IS a multi-platform solution... but it is entirely up to you :)

                  1 Reply Last reply Reply Quote 0
                  • M
                    mbnoimi last edited by

                    bq. This IS a multi-platform solution… but it is entirely up to you :)

                    This isn't a pure cross-platform solution it may work under some platforms (as number of ifs you type).

                    My question is crystal clear, I don't want to add any IF statement I'm looking for "copy" command works on all available platforms for Qt.

                    1 Reply Last reply Reply Quote 0
                    • C
                      ChrisW67 last edited by

                      bq. My question is crystal clear, I don’t want to add any IF statement I’m looking for “copy” command works on all available platforms for Qt.

                      There is no such beast.

                      qmake defines some variables for its internal use that you could try to use: QMAKE_COPY, QMAKE_COPY_DIR, QMAKE_MOVE, QMAKE_DEL_FILE, QMAKE_DEL_DIR, QMAKE_CHK_DIR_EXISTS, QMAKE_MKDIR
                      Bear in mind these are not documented (and differ from Qt4 to Qt5 I think).

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post