Closed drizt closed 5 years ago
I dump all properties for Qt5::Gui
and one from them:
Qt5::Gui INTERFACE_INCLUDE_DIRECTORIES = /usr/include/qt5/;/usr/include/qt5/QtGui;/usr/include
Also I opened CMake sources. They exclude /usr/include
. https://github.com/Kitware/CMake/blob/master/Source/cmLocalGenerator.cxx#L964
@drizt Hi, thanks for the root cause analysis. Can you please let me know if removing /usr/include
from Qt's INTERFACE_INCLUDE_DIRECTORIES
fixes the problem? If yes, I believe it is Qt to be blamed not CMakePCHCompiler.
Apparently CMake there at https://github.com/Kitware/CMake/blob/master/Source/cmLocalGenerator.cxx#L964 hardcodes some bugfix, which is obviously not affecting CXXPCH
& CPCH
derived PCH languages.
Yes. For Qt5 I use such workaround:
get_target_property(Qt5GuiIncDirs Qt5::Gui INTERFACE_INCLUDE_DIRECTORIES)
list(REMOVE_ITEM Qt5GuiIncDirs "/usr/include")
set_target_properties(Qt5::Gui PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Qt5GuiIncDirs}")
And this for Qt4:
get_target_property(Qt4GuiIncDirs Qt4::QtGui INTERFACE_INCLUDE_DIRECTORIES)
list(REMOVE_ITEM Qt4GuiIncDirs "/usr/include")
set_target_properties(Qt4::QtGui PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Qt4GuiIncDirs}")
get_target_property(Qt4CoreIncDirs Qt4::QtCore INTERFACE_INCLUDE_DIRECTORIES)
list(REMOVE_ITEM Qt4CoreIncDirs "/usr/include")
set_target_properties(Qt4::QtCore PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Qt4CoreIncDirs}")
list(REMOVE_ITEM QT_INCLUDE_DIR "/usr/include")
You use non-standard lang for pch header. It's very rare case. I think this problem can happens in other cases not only mine. Maybe this information should be add to README or there is a way to workaround it in your CMakePCHCompiler?
Okay, thanks for the update. Do you think we should keep this issue open or we can close it now?
This was very likely fixed by fa975ba71ae3a2f664b60ed2b718dc2c5d26c38f and looks similar to #36, anyways the example in Tests/Issue36_QTFramework
now works.
OS Fedora 29
I can set manually C++ standard. But in this case I got another error.
PCH adds
-isystem /usr/include
which missing in normal compilation process. This flag comes from Qt5::Gui library.