[CMake] FIND_PACKAGE REQUIRED - concept chnage?

Jan Woetzel jw at woetzelweb.de
Mon Jun 19 16:16:08 EDT 2006


Jan Woetzel wrote:

> The REQUIRED flag checking in
> FIND_PACKAGE(Foo REQUIRED)
> is not checking the result of FOO_FOUND anymore.


(1) Each Find script has to handle _REQUIRED and _QUIT handling itself 
with 2.4.x, right?
E.g.:

  IF(NOT Foo_FIND_QUIETLY)
    IF(Foo_FIND_REQUIRED)
      MESSAGE(FATAL_ERROR "Foo required, please specify it's location.")
    ELSE(Foo_FIND_REQUIRED)
      MESSAGE(STATUS      "Foo was not found.")
    ENDIF(Foo_FIND_REQUIRED)
  ENDIF(NOT Foo_FIND_QUIETLY)

In 2.0.6 each find script just had to set _FOUND and the FIND_PACKAGE 
command was handling teh rest automatically.
I think the breaking change has to do with the 27.Jan.2006 fix for
http://www.cmake.org/Bug/bug.php?op=show&bugid=2771

(1) I agree with setting the additinal variables .- but this breaking 
with backward compatibility intentionally (and for what reason) ?

(2) The documentation is only in Modules/readme.txt
but missing in the  FIND:_PACKAGE commadn help.

 >>
A FindXXX.cmake module will typically be loaded by the command

  FIND_PACKAGE(XXX [QUIET] [REQUIRED [components...]])

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.  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.
<<


Jan.

-- 

  Dipl.-Ing. Jan Woetzel
--------------------------------------------------
  Uni Kiel
  Institut f. Informatik und Praktische Mathematik
  Hermann-Rodewaldstr. 3  [Raum 310]
  24098 Kiel/Germany
--------------------------------------------------
  Tel    +49-431-880-4477
  Fax    +49-431-880-4054
  Privat +49-431-802872
  Mob.   +49-179-2937346
--------------------------------------------------
  Url    www.mip.informatik.uni-kiel.de/~jw
  Email  jw at mip.informatik.uni-kiel.de
  Privat jw at WoetzelWeb.de



More information about the CMake mailing list