Important: Please read the Qt Code of Conduct -

Qmake delete a directory in osx

  • Is it possible to delete a directory by just adding some code in the .pro file ? Here is the situation:

    I have defined my proper build output into a separate build folder by overriding DESTDIR as below,

    Now I want to delete the extra build directory that was created default by qmake or qt. One with the name as "build-android-version #-blah-blah"

    Is it possible to persuade qmake to delete that default shadow build directory ?

  • Really appreciate any help offered here. Thanks in advance

  • Lifetime Qt Champion


    Why do you want to delete the shadow build folder ?

  • @SGaist I am creating my own build directory with simple proper names where all the libraries of my project get built in. In this case it doesnt make sense to allow the shadow build folders to get created & just left around. So, I want to delete the shadow build folder to keep things clean.
    Also, I am making my modules available 4 different platforms which creates a long list of shadow build folders which are just getting created lying around for no use. I really want to keep this clean so that other developers do not complain of the unrequited default shadow build folders increasing junk in the build directory.

  • Lifetime Qt Champion

    Shadow builds are an option in Qt Creator, just disable it there.

  • @SGaist If I disable it, then it wont affect the destdir that I am defining & putting in the final built binary. Right ? or no ?

    How can I disable the shadow build option ?

    Thanks for you attention

  • I found the shadow build check box can be disabled in the projects menu under General category. But this is an option that needs to be checked off by each developer, under each platform build type, under each library & also app.

    Isnt, there a property I can set in .pro file to disable shadow build of my libraries & app ? Or some kind of a one time do it simple solution ?

  • Lifetime Qt Champion

    No, nothing in the .pro file. As I wrote before, shadow builds are nice option provided by Qt Creator in order to avoid polluting one's source with build artifacts.

    Note that setting DESTDIR only tells qmake where to put your final binary, all build artifacts stay where the build happens.

    One alternative that you can use is to put all shadow builds under a common folder.

Log in to reply