Change the default build path automatically



  • Hi together,

    please let me short explain what I mean:-) We develop applications under Windows and Linux for these systems and the phyFlex i.MX6 (linux cross compile). To handle depending projects like libs and applications I have created a meta-project (like a solution in VStudio)

    @
    TEMPLATE = subdirs
    CONFIG += ordered
    SUBDIRS = ../mwbase
    ../mwfirstgui
    @

    Very fine and it is possible to switch between the build target and debug/release with one selection, what isn't possible with QtCreator session.

    All sources and the .pro files in the version control system.

    When somebody check out the source and load the .pro file in the QtCreator the first action is to configure the project by selecting the target and input the build paths for debug and release.

    Can this step automated? Our build path is a relative path like ../qtbuild/<target>/<project>. Is there a template from which QtCreator extracts the default build path?
    I have checked the .pro.shared file but without success.

    I know that is no problem to input the right path and I complete understand why this is needed. But I know programmers, git clone; load .pro file; click configure project (don't reading the developers guide) and the results are in the wrong directory:-(

    Sorry for the long description, I hope that it is understandable what I mean, thanks.


  • Moderators

    You can hard-code paths using qmake variables: DESTDIR, MOC_DIR, UIC_DIR, RCC_DIR, OBJECTS_DIR. See "this project":https://github.com/sierdzio/qeasyshell/blob/master/global.pri for reference - exactly as in your case, I'm using subdirs and the files are configured so that it all builds neatly by default.

    Qt Creator still has power to override some settings, you would need to disable shadow building (but here we come back to your problem - the developers don't configure their environment correctly).


  • Moderators

    Don't hard-code paths!

    Go to Tools>Options>Build & Run>General and change the "Default build directory".

    Note that qmake might break in unexpected ways if the build and the source dir are not at the same level (== do not contain the same number of '/' or ''). I think your build directory is problematic.


  • Moderators

    Tobias the guy is saying clearly that he is aiming for a solution that would not require any adjustments to be made by the developers using the project.



  • Yes, I agree.

    I see that the only way at the moment is to change the "Default build directory" for the meta-project.

    QtCreator will create the same structure in the qtbuild directory, which is good at moment.
    Before I ask this question I have take a look to the Qt source code structure. But it looks not very easy but I will study this more as an example of a complex project.

    Target is to have minimal manual actions after clone the source from the version control system.


Log in to reply
 

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