Priority: P4: Low
Affects Version/s: 5.15.2
Fix Version/s: None
Component/s: Build tools: qmake
Environment:Windows 10, 64-bit; Qt 5.15.2; qmake 3.1; MSVC 2019 Community; CL version 19.28.29337-x64
- You have a project with subprojects (e.g. a subdirs project), and
- You're using the MSVC kit (only tested with 2019 64-bit), and
- You have shadow builds disabled, and
- Multiple subprojects have a source file with the same name
- If there is a compilation error in one of those source files, the "Issues" pane is unable to distinguish which file is being referred to, and thus presents the file selection drop down.
This happens because:
- With shadow builds disabled, CL only outputs the base source filename in diagnostics messages (with shadow builds enabled, there is a relative path prefix and the issue is moot), e.g.:
main.cpp(7): error C2143: syntax error: missing ';' before 'return'
A workaround is to force CL to output full pathnames (docs), which can be done in the subprojects' .pro files like:
win32-msvc*:QMAKE_CXXFLAGS += /FC
This will cause diagnostics to appear as, for example:
C:\Users\jason\Projects\Qt\subdirtest\untitled2\main.cpp(7): error C2143: syntax error: missing ';' before 'return'
Thus providing Creator with enough information to identify the source file.
While this behavior makes sense, it is inconsistent with expectations, and with behavior from other configurations, and I don't think it is intended. In any case, it is mildly inconvenient and a solution theoretically exists. So I am calling it a "bug", although it could just be a feature request.
One solution (acceptable, in my opinion) is to have whatever magic happens between Creator and build time add the /FC compiler option when shadow builds are disabled for that kit. But, I don't really know how the internals work so, I dunno.
An example project file (.user file included) is attached if it is useful. Be sure it is configured to MSVC with shadow builds disabled, then build it and double-click the diagnostics in the Issue pane.