Qt Creator warning "The build directory needs to be at the same level as the source directory."



  • After upgrading to 6.9.1, we've got:

    "-1: warning: The build directory needs to be at the same level as the source directory."

    There are no problems with the build itself, but this warning interferes with our requirement of 100% clean builds.
    What we can do to turn off or hide this warning?

    Notes:

    • Our build system puts the root of the shadow build paths outside of the source tree, so yes, the generated files end up in directories with different nesting level than the source files (but if course the relative sub-dirs do match the source sub-dirs, and qmake does not give us any problems)
    • Internet search brings up https://bugreports.qt.io/browse/QTCREATORBUG-16616 which (kinda) explains the reasoning behind this warning.
    • No matter what the motivations are, developers should be able to turn off this warning if they choose to do so.

    Thanks in advance,


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    In that case the most simple would likely be for you to add an option to Qt Creator for that.



  • @SGaist Thank you for you welcome!
    Let me re-phrase my original question: is there any way to turn off or hide this warning without getting into business of building custom version of Qt Creator?



  • Hi, I've also got that warning after upgrading, I've managed to turn it off by exiting Qt Creator, deleting the .pro.user file for my project, starting Qt Creator again (and reselecting the compiler).



  • @hskoglund Unfortunately it doesn't help in our case - before full build we delete everything, including .pro.user files (so every time the project tree looks exactly as it was retrieved from source control).



  • Ok, so as part of your build you generate fresh .pro.user files as well (i.e. not picking up/storing any .pro.user files in your source control)?


  • Qt Champions 2016

    Hi
    It comes from using Shadow Build folder. qmake will fail in rare cases when
    build folder is in wrong nesting level. There is no way to disable it unless you
    follow the rule. :)

    I also wish they added a .pro key to disable this warning as i can with most others messages.



  • @hskoglund We do not check-in any user-specific files such as .pro.user, and Qt Creator does generate fresh copy because we delete it every time before full clean build. But .pro.user itself has nothing to do with the warning. It's caused by location of our Shadow Build root. https://bugreports.qt.io/browse/QTCREATORBUG-16616 explains the story.


  • Lifetime Qt Champion

    Just one philosophical question (and there's no hidden motivation for a flamewar): AFAIU, a zero warning policy should apply to the active building of your project, correct ? What you have here is an IDE only warning that you wouldn't get from your CI server thus, does it really interfere with your policy ?



  • @mrjj usually the compiler warnings get controlled from a .pro file. Are you saying that it's also possible to do for the warnings/messages from Qt Creator itself? If yes, how?
    Thanks in advance,



  • @SGaist There are no problems on the build server (otherwise it would've been a shipping blocker, yikes).
    But our policy requires devs to have a clean build before commit, and usually it's done from the IDE. Once we learn to ignore one warning, it becomes much easier to overlook another (the relevant) one. The risk of build breaks goes up.


  • Lifetime Qt Champion

    I completely see your point.

    Then it would likely make sense to add a disabler to Qt Creator in e.g. Build And Run even though you'd like to avoid build Qt Creator yourself. You could even submit it for inclusion.



  • @SGaist I didn't have a chance yet to spend any time with Qt Creator code base. But it looks like a good motivation :) Though I'd appreciate a hint which part of the source tree to start looking at.


  • Lifetime Qt Champion

    The Project Explorer plugins is likely the place you will be interested in.


  • Qt Champions 2016

    Hi
    It seems to be here.
    \src\plugins\qtsupport\baseqtversion.cpp" LINE 1336

    QList<Task> BaseQtVersion::reportIssuesImpl(const QString &proFile, const QString &buildDir) const
    {
    ...
      QString sourcePath = QFileInfo(proFile).absolutePath();
        const QChar slash = QLatin1Char('/');
        if (!sourcePath.endsWith(slash))
            sourcePath.append(slash);
        if (tmpBuildDir.count(slash) != sourcePath.count(slash)) {
            const QString msg = QCoreApplication::translate("QmakeProjectManager::QtVersion",
                                                            "The build directory needs to be at the same level as the source directory.");
    
            results.append(Task(Task::Warning, msg, FileName(), -1,
                                ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
        }
    
        return results;
    }
    

Log in to reply
 

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