Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator warning "The build directory needs to be at the same level as the source directory."
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
15 Posts 4 Posters 6.5k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • hskoglundH Offline
    hskoglundH Offline
    hskoglund
    wrote on last edited by
    #4

    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).

    alik_coA 1 Reply Last reply
    0
    • hskoglundH hskoglund

      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).

      alik_coA Offline
      alik_coA Offline
      alik_co
      wrote on last edited by
      #5

      @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).

      1 Reply Last reply
      0
      • hskoglundH Offline
        hskoglundH Offline
        hskoglund
        wrote on last edited by
        #6

        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)?

        alik_coA 1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #7

          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.

          alik_coA 1 Reply Last reply
          0
          • hskoglundH hskoglund

            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)?

            alik_coA Offline
            alik_coA Offline
            alik_co
            wrote on last edited by alik_co
            #8

            @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.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #9

              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 ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              alik_coA 1 Reply Last reply
              0
              • mrjjM mrjj

                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.

                alik_coA Offline
                alik_coA Offline
                alik_co
                wrote on last edited by
                #10

                @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,

                1 Reply Last reply
                0
                • SGaistS SGaist

                  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 ?

                  alik_coA Offline
                  alik_coA Offline
                  alik_co
                  wrote on last edited by
                  #11

                  @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.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #12

                    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.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    alik_coA 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      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.

                      alik_coA Offline
                      alik_coA Offline
                      alik_co
                      wrote on last edited by
                      #13

                      @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.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #14

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

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #15

                          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;
                          }
                          
                          1 Reply Last reply
                          2

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved