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, at
C:\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?
Mac inside virtual host its like a fish outside water....
try to put this 3 variable in your profile... hidden is better like .o
MOC_DIR = o
RCC_DIR = o
OBJECTS_DIR = o
@patrik08 I tried that and I still get the warning.
and build from source normal... if its go normal on
qmake && make
the problem is on qtcreator setting project...
i dont trust virtual box...
@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\oinstead of the
build-myproject\releasefolder (I'm using Visual Studio compiler which creates subfolders of the build directory called "debug" or "release").
Haha.. lol.. i never use visual st.. only the free MinGW ...
i remember me 25 years a go i read Microsoft Frontpage book 500 pages.... my mind go crazy...
also write i pro file
OBJECTS_DIR = 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 \
Its not possible to disable this warning at present time.