Prevent codeModel from considering some spaces as Compiler Flags delimiters
-
Linked to the issue I mentionned here: https://forum.qt.io/post/831373
This happens on Windows 11, QtCreator 17.0.0, when compiling Qt5 or Qt6 projects.
When adding compiler flag using the
QMAKE_CXXFLAGSvariables they are taken into account by the Code Model but the Code Model seems to always consider spaces as flags delimiters (even when the flag is surrounded by properly escaped double quotes).One usecase we have at my workplace is when using the
/external:Ifrom MSVC cl or/imsvcfrom clang-cl instead if using QtCreatorINCLUDEPATHvariable. We do that to allow the inclusion of an external library without having the compiler generate warning from the library's header files. This works fine unless there is a space in the include path.For example if I have
QMAKE_CXXFLAGS += /imsvc\"C:/path with spaces /to/include/folder\", the code will compile and run fine but the code model will split this into 4 flags (/imsvc\"C:/path,with,spacesand/to/include/folder\") :

This causes the code model to break itself, consider it is setup for CXX98 and generates warning everywhere.
Is there a way to escape those inner spaces (I tried to put a
\in front of the spaces but it doesn't seem to work) or to declare an external include path using a Qt variable ? -
This post is deleted!