Important: Please read the Qt Code of Conduct -

[Solved]how to setup Multiple DESTDIR?

  • Hi friends,

    How to have multiple DESTDIR for my project.

    In my team, other developers also using my code and testing it in the embedded system.So whatever the changes i do in my .so files should reflect in their system also.

    copying and pasting the .so 's every time is annoying.

    Whenever i build my project, it should automatically update .so file in the more than one directory.How to do that?

  • Moderators

    Copy it using a command passed to QMAKE_POST_LINK. Just be aware of "this":

  • thank you.

    this works when i add it in .pro file.

    QMAKE_POST_LINK += cp /exports/nfsroot-ccwmx51js/home/ /mnt/TestingPC/nfsroot-ccwmx51js/home/

    i can get in both
    /exports/nfsroot-ccwmx51js/home/ &


  • Moderators

    Great! Happy coding!

  • or you can add an INSTALLS target that will perform the additional copies upon installing to your main DESTDIR.


    equals(TEMPLATE, lib) {
    target.path = $${DESTDIR} # or whatever other dir
    INSTALLS += target

    this will work only if the template is for creating shared libs.
    on my box QMAKE_EXTENSION_SHLIB wasn't set, if that is the case just stick the ".so" suffix manually

    this will require performing "make install" but has the advantage of keeping things separate.

  • @compor,

    I added this code in my pro,but only it generated output in DESTDIR. anything i'm missing?

    @equals(TEMPLATE, lib) {
    target.path = $${DESTDIR} # or whatever other dir
    target.extra = cp $${QMAKE_PREFIX_SHLIB}$${TARGET}.$${QMAKE_EXTENSION_SHLIB} /exports/nfsroot-ccwmx51js/home; cp $${QMAKE_PREFIX_SHLIB}$${TARGET}.$${QMAKE_EXTENSION_SHLIB} /mnt/ElangovanPC/nfsroot-ccwmx51js/home;
    INSTALLS += target

  • make sure the command has ended up in the generated Makefile (just search for it in there) and then you need to do a "make install".

Log in to reply