Despite skipping a *.pro file via qtHaveModule(quick), qmake fails due to missing gui module
-
Hi,
i have
QT += quickin one of my qmake project files. Because I build several projects within my subdirs project, I want certain target environments to compile only the stuff that does not depend on graphical stuff because the targets are headless.So I decided to entirely skip the build of the gui dependent pro files via
qtHaveModule(quick){ DEFINES += \ BLABLA_UI_LIBRARY QT += quick [...] } else { message("QtQuick not available, skipping building the blabla-ui lib") }However those headless systems fail to run qmake. They successfully print the error message that
quickis not available and afterwards fail nonetheless:Project MESSAGE: QtQuick not available, skipping building the blabla ui lib Project ERROR: Unknown module(s) in QT: guiAny ideas what to do further? Thanks in advance.
The full log, starting with the skip is here:
https://gist.github.com/darkmattercoder/e82b62638ec76597fb7365e1cf404275
-
Hi,
i have
QT += quickin one of my qmake project files. Because I build several projects within my subdirs project, I want certain target environments to compile only the stuff that does not depend on graphical stuff because the targets are headless.So I decided to entirely skip the build of the gui dependent pro files via
qtHaveModule(quick){ DEFINES += \ BLABLA_UI_LIBRARY QT += quick [...] } else { message("QtQuick not available, skipping building the blabla-ui lib") }However those headless systems fail to run qmake. They successfully print the error message that
quickis not available and afterwards fail nonetheless:Project MESSAGE: QtQuick not available, skipping building the blabla ui lib Project ERROR: Unknown module(s) in QT: guiAny ideas what to do further? Thanks in advance.
The full log, starting with the skip is here:
https://gist.github.com/darkmattercoder/e82b62638ec76597fb7365e1cf404275
@devjb said in Despite skipping a *.pro file via qtHaveModule(quick), qmake fails due to missing gui module:
Project ERROR: Unknown module(s) in QT: gui
If you don't you
gui, you should insert in your PRO fileQT -= guiqtHaveModule(quick){ DEFINES += \ BLABLA_UI_LIBRARY QT += quick [...] } else { message("QtQuick not available, skipping building the blabla-ui lib") QT -= gui } -
Well, that was a quick and obvious fix... worked
However, I do not understand why the error appears in the first place. Because qmake should not process the file at all.
I have several other project files, some of them containQT-=guiand some of them don't, however they all build successfully, even those where I did not put that in.Furthermore, the project file in question is practically empty beside the
qthavemodulecheck, so why tries qmake to do something else afterwards.I simply want to get at least a kind of understanding of what goes on here.
-
Well, that was a quick and obvious fix... worked
However, I do not understand why the error appears in the first place. Because qmake should not process the file at all.
I have several other project files, some of them containQT-=guiand some of them don't, however they all build successfully, even those where I did not put that in.Furthermore, the project file in question is practically empty beside the
qthavemodulecheck, so why tries qmake to do something else afterwards.I simply want to get at least a kind of understanding of what goes on here.
@devjb said in Despite skipping a *.pro file via qtHaveModule(quick), qmake fails due to missing gui module:
I simply want to get at least a kind of understanding of what goes on here.
As describe here ==> https://doc.qt.io/qt-5/qtgui-index.html
GUI module is included by default and must be removed if not required/used -
@KroMignon thanks for the clarification
Well, my approach was even wrong in the first place.
What I wanted to achieve is done via one line in the*.profile:requires(qtHaveModule(quick))this is was I was looking for and gives me the correct results that I am expecting.
-
@KroMignon thanks for the clarification
Well, my approach was even wrong in the first place.
What I wanted to achieve is done via one line in the*.profile:requires(qtHaveModule(quick))this is was I was looking for and gives me the correct results that I am expecting.
@devjb said in Despite skipping a *.pro file via qtHaveModule(quick), qmake fails due to missing gui module:
this is was I was looking for and gives me the correct results that I am expecting.
Sorry, I have readed too fast your post! Yes, using
requires()is the right way to do what you want!