[CMake] find_package with COMPONENTS never honors REQUIRED
George PF
george.p.f at mail.com
Thu Aug 30 14:03:44 EDT 2018
> The documentation is intriguing about REQUIRED COMPONENTS interaction....
That's... one way to put it.
> "A package-specific list of required components may be listed after the
> ``COMPONENTS`` option (or after the ``REQUIRED`` option if present).
> Additional optional components may be listed after
> ``OPTIONAL_COMPONENTS``."
>
> and....
>
> "Available components and their influence on
> whether a package is considered to be found are defined by the target
> package."
>
> and later on:
>
> "In Config mode ``find_package`` handles ``REQUIRED``, ``QUIET``, and
> ``[version]`` options automatically but leaves it to the package
> configuration file to handle components in a way that makes sense
> for the package. The package configuration file may set
> ``<package>_FOUND`` to false to tell ``find_package`` that component
> requirements are not satisfied."
>
> So it is possible that the failure behavior when specifying COMPONENTS is up to the module...
I admit I was not reading the docs in that depth, but REQUIRED can only mean one thing and should
not need second guessing the documentation. Sadly, someone thought otherwise.
> Do you see this only with Qt or do other packages with components (may be Boost) behave like this?
> I guess that Qt5 should be running in config mode, whereas boost must be in module mode though.
I was debugging an older cmake project and wondered why it was not finding the non-standard Qt location,
that's when I stumbled upon this issue.
GPF
More information about the CMake
mailing list