[SOLVED]Multi-destinations for Qt project



  • 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@



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



  • 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)



  • 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)



  • 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) :)



  • [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.



  • 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 :)



  • 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.



  • 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).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.