Congratulations to our 2022 Qt Champions!

Copy files as part of build?

  • My app uses a couple of executables that it will look for in a folder called "apps", adjacent to the main app.
    I want to be able to create the "apps" folder and copy my two files there, as part of doing a build.
    Right now I am doing this with a custom build step that does "make install" and doing something like
    this in my .profile:

     install_it.path = build/apps
     install_it.files += src-apps/some-app
     install_it.files += src-apps/another-app
     INSTALLS += install_it

    But this does not thrill me, in that (I think) custom build steps only line in Creator, and only on my system. Someone else should be able to install Qt, get my project from git build and run without extra setup steps.

    Is there a way to do what I want here, but without using a custom build step, or requiring "make install"?


  • OK, Answering my own question. You can (apparently) create a series of commands using QMAKE_POST_LINK.

    QMAKE_POST_LINK += $$quote(mkdir -p ./apps $$escape_expand(\n\t))
    QMAKE_POST_LINK += $$quote(cp ./../../macApps/gs ./apps/gs $$escape_expand(\n\t))
    QMAKE_POST_LINK += $$quote(cp ./../../macApps/gxps ./apps/gxps $$escape_expand(\n\t))

Log in to reply