[CMake] find_package REQUIRED ignores OPTIONAL_COMPONENTS

Jakob van Bethlehem jsvanbethlehem at gmail.com
Tue Mar 22 03:48:09 EDT 2016


Hm, interesting. I wonder then if Qt-devs are maintaining this, or the
CMake-devs? If the same bug is still present in Qt5, it should be fixed.

Sincerely,
Jakob

On Sun, Mar 20, 2016 at 8:37 PM, Alexander Stein <
alexander.stein+cmake at mailbox.org> wrote:

> On Tuesday 08 March 2016, 10:00:00 wrote Nicholas Braden:
> > Jakob, I don't think there is any confusion about what REQUIRED means.
> > Whether or not REQUIRED is provided, the list of OPTIONAL_COMPONENTS
> > should not be required under any circumstances. The example error
> > message seems pretty clear to me that the expected behavior and actual
> > behavior are different. I went and looked at the source code of the
> > find module:
> >
> > https://github.com/Kitware/CMake/blob/master/Modules/FindQt4.cmake
> >
> > It seems that there is no check whatsoever for
> > Qt4_FIND_REQUIRED_<component>, so the find module just blindly assumes
> > that all components are required.
> >
> > More info:
> https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#find-modules
> >
> > To me this seems like a bug in the find module.
>
> Yep, FindQt4.cmake doesn't support OPTIONAL_COMPONENTS which seems only to
> work if FIND_PACKAGE_HANDLE_STANDARD_ARGS is called with HANDLE_COMPONENTS
> passed. This is not the case and does not work. I guess due to different
> naming scheme used for components. AFAICS they have to be e.g.
> Qt4_QtCore_FOUND, but not QT_QTCORE_FOUND.
>
> Best regards,
> Alexander
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160322/fe8d2915/attachment.html>


More information about the CMake mailing list