Disable “The build directory needs to be at the same level as the source directory” warning in Qt Creator
-
I have a Qt project located in the folder
C:\Users\donaldduck\OneDrive\Documents\myproject
, and I want to have the build directory as a subfolder of the source directory, atC:\Users\donaldduck\OneDrive\Documents\myproject\build-myproject
. The problem is that Qt Creator gives me a warning saying "The build directory needs to be at the same level as the source directory":Other than this warning, the project compiles just fine. I don't even get any problems that the build directory is a subfolder of the source directory. I searched on the web to see why I get this warning, and I found that it's probably because not having the build directory at the same level as the source directory could cause problems with relative paths. But I don't have any relative paths in my program, I have all of the files in a QRC resource.
So this error is just annoying, and I would like to disable it. I've searched the web for a solution, but haven't found anything.
Also, I only get this warning on my Windows computer and on my Mac virtual machine. I have a similar folder structure (the build directory is a subfolder of the source directory) on my Linux virtual machine, but none of them give any warning. Also, before I updated Qt on Windows, I didn't get that warning, but since I updated it I've been getting this warning on Windows also.
How can I disable this warning?
-
@patrik08 Forget about VirtualBox. I tested your code on Windows (not a virtual machine) by writing the code in the pro file, running QMake and compiling it. It still gave the warning and besides it put the executable in a folder called
build-myproject\o
instead of thebuild-myproject\release
folder (I'm using Visual Studio compiler which creates subfolders of the build directory called "debug" or "release"). -
the reason for this warning is, that qmake may have problems if the build dir is below the source dir (i.e. not at the same hierarchy). there was some work on qmake which improved (but not fully solved qmakes restriction). therefore, some creator version removed the warning and some later reintroduced it.
-
normaly i use pri file... to include..
after file can stay on other disk or 4 level down ... its not important... only $$PWD/ say how to find file... same level or not...# Input HEADERS += $$PWD/rtf-qt/TextDocumentRtfOutput.h \ $$PWD/rtf-qt/AbstractRtfOutput.h \ $$PWD/rtf-qt/AuthorPcdataDestination.h \ $$PWD/rtf-qt/CategoryPcdataDestination.h \ $$PWD/rtf-qt/ColorTableDestination.h \ $$PWD/rtf-qt/CommentPcdataDestination.h \ $$PWD/rtf-qt/CompanyPcdataDestination.h \ $$PWD/rtf-qt/controlword.h \
-
Hi
Its not possible to disable this warning at present time.
https://bugreports.qt.io/browse/QTCREATORBUG-16616