FindQt4 doesn't honour OPTIONAL_COMPONENTS when used with REQUIRED
find_package(Qt4 4.8.7 REQUIRED COMPONENTS QtCore OPTIONAL_COMPONENTS QtGui)
If QtGui cannot be found, it produces error (or simple message if REQUIRED
is not specified) Could NOT find Qt4 (missing: QT_QTGUI_LIBRARY)
, even though QtGui is listed as OPTIONAL
.
My suggestion is:
- modify
FindQt4
to use<package>_FIND_REQUIRED_<component>
variables when creating a list ofREQUIRED_VARS
in FPHSA, - since it will silently skip missing optional components, I also suggest adding
HANDLE_COMPONENTS
in FPHSA, which will also require to set proper..._FOUND
variables in module.
This will then produce the following message -- Found Qt4: <...> found components: QtCore missing components: QtGui
if QtGui is not found.
Patch: FindQt4.patch