Important: Please read the Qt Code of Conduct -

C++ source files generated from QML clutter the project folder

  • Hello!
    I have come across an issue when building my application in release mode as compared to debug mode.
    When building the project a bunch of .cpp files based on my .qml files are generated, which are all placed in the root directory of my project.
    This is also happening in debug mode for the .qrc files, which I was living with as this is easy to filter in .gitignore (they are always prefixed with qrc_*.cpp). However, filtering the C++ source files is harder as they don't follow a common naming convention.

    Is there a way to redirect this output to a different location, similar to the configuration I am using in my .pro file for the moc and obj artifacts?

    DESTDIR  = $$PWD\bin
    MOC_DIR = $$PWD\tmp\moc
    OBJECTS_DIR = $$PWD\tmp\obj

    I am using Qt 5.12.4 with Qt Creator 4.9.1, compiling with MSVC 2017 32bit.
    Thank you!

  • Moderators

    hi @Boaschtel

    I think what you're looking for is

    UI_DIR  //only used for .ui files in QWidgets

  • Thank you, those were the settings I was looking for!

Log in to reply