[CMake] FIND_PACKAGE: QUIET and REQUIRED should be mutually exclusive, right?

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Tue Jun 26 17:57:18 EDT 2007


Hello all,

The following text is from the readme.txt found in the cvs Modules directory:

<start quoting>
If the QUIET option is given to the command it will set the variable
XXX_FIND_QUIETLY to true before loading the FindXXX.cmake module.  If
this variable is set the module should not complain about not being
able to find the package and should never issue a FATAL_ERROR. If the
REQUIRED option is given to the command it will set the variable
XXX_FIND_REQUIRED to true before loading the FindXXX.cmake module.  If
this variable is set the module should issue a FATAL_ERROR if the
package cannot be found.  For each package-specific component, say
YYY, listed after the REQUIRED option a variable XXX_FIND_REQUIRED_YYY
to true.  The set of components listed will also be specified in a
XXX_FIND_COMPONENTS variable.  This can be used by the FindXXX.cmake
module to determine which sub-components of the package must be found.
If neither the QUIET nor REQUIRED options are given then the
FindXXX.cmake module should look for the package and complain without
error if the module is not found.
<end quoting>


Hence, what I gather is that:

1. neither QUIET, nor REQUIRED: means complain, but don't issue FATAL_ERROR
2. QUIET: means don't complain and don't issue FATAL_ERROR
3. REQUIRED: means complain and issue FATAL_ERROR
4. What about QUIET and REQUIRED?

>From the text I would assume that these are mutually exclusive, but if
you use the following line:
  FIND_PACKAGE(Foo QUIET REQUIRED)

  Foo_FIND_QUIETLY and Foo_FIND_REQUIRED are both set...

Also, the line in the help documentation,
  FIND_PACKAGE(<name> [major.minor] [QUIET] [NO_MODULE]
               [[REQUIRED|COMPONENTS] [componets...]])
implies that they can be used together...

Are there cases where QUIET and REQUIRED are used together, or are
they supposed to be mutually exclusive?

If they should be mutually exclusive, then CMake should handle the
parsing correctly and the documentation clarified...

Thanks,
--Miguel


More information about the CMake mailing list