Important: Please read the Qt Code of Conduct -

Any way to set a kit-specific target.path?

  • I have two kits, one for RPi and another for Odroid. I would like to configure the same project for both kits, and deploy to both in possibly different locations on either device. Is there a way to set the target.path independently for both kits? How can I avoid having to change the target.path in the .pro file every time I switch kits?

    I tried setting target.path to one that I might replicate on both devices, e.g.

    target.path = ~/Projects/Qt

    but I guess the ~ is a shell expansion, so that doesn't work.

  • Lifetime Qt Champion


    One thing you could try is to modify the build environment variables (in the kit page) and add there a variable for the path you would like to use but beware, it will also be valid for all your other projects. Otherwise, you can do something similar that will only apply to your project in the Build part of the Project panel.

    Hope it helps

  • I tried what you suggested, and added a Build Env variable called QT_TARGET_DIR, set to /home/odroid/Projects/Qt. Then in my .pro file I set target.path = $QT_TARGET_DIR. That worked, but to my surprise, the deploy step had created a new directory called $QT_TARGET_DIR under /home/odroid and deposited the executable there.

    So I changed target.path to target.path = Projects/Qt and now it works (although I'm not sure how - does $HOME get prefixed conditionally onto target.path?), deploying to ~/Projects/Qt on both devices. I can live with that, but if there is a clean way to specify absolute target path via a build env var, please let me know.

  • Lifetime Qt Champion

    I'd recommend using some other prefix for your environment variable. At some point it could be used by the project or some colleague of you might think it's an official environment variable used by the Qt project.

Log in to reply