I have a Qt project located in the folder /Users/donaldduck/OneDrive/Documents/myproject
, and I want to have the build directory as a subfolder of the source directory, at /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?
Disabling not possible but the solution is to change build directory.
This warning does show if the source- and the build directory do not contain the same number of /
(or \
on windows) in their absolute path names.
Assuming your source directory is "c:\dev\source\project", then "..\build-directory" is fine, but e.g. "..\build\directory" is not. "c:\dev\build\project\debug" is not ok, but "c:\dev\build\project-debug" is. "./debug" and "debug" are not ok as build directories either.
Is what you can observe as well? Or are all paths starting with "..\" triggering this warning?
Qmake will fail to build projects that are not following the "same distance from root" rule in some rare corner cases and will produce really cryptic output when it does. So we need to warn about a setup like this.
you can use your default directory like this: ../%{CurrentBuild:Name}
Screenshot:
I use this directory: ../Build/Windows/%{CurrentBuild:Name}
and I don't care about the warning!
Reference: https://bugreports.qt.io/browse/QTCREATORBUG-16616
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With