Suggested patch for FindOpenGL.cmake

Brad King brad.king at kitware.com
Tue Jun 20 22:36:29 CEST 2006


Paulo Moura Guedes wrote:
> So I would add that logic to the automated proposal. Before executing 
> FindFoo.cmake instructions, cmake, through FIND_PACKAGE, would do something 
> like this:
> 
> if(FOO_FOUND)
> 	return;
> [else] if(FOO_LIBS and FOO_INCLUDES) {
> 	FOO_FOUND = true;
> 	return;

The assumption that FOO_LIBS and FOO_INCLUDES implies FOO_FOUND is too
strong to make in FIND_PACKAGE.  That will have to be done by the find
module itself because only the module knows what it means for FOO to be
found.

The short-cut in FIND_PACKAGE for FOO_FOUND will be meant only to
prevent multiple calls to FIND_PACKAGE(FOO) from both having to process
all the code in FindFOO.cmake.  On the other hand if FOO was not found 
the first time the module was included why would it be found the second 
time?

Instead we should just add include blockers around the whole find module:

IF(NOT FOO_FIND_INCLUDED)
   SET(FOO_FIND_INCLUDED 1)
   # ... rest of code ...
ENDIF(NOT FOO_FIND_INCLUDED)

We cannot do this automatically in FIND_PACKAGE because some find 
modules may change their behavior based on variable settings and not 
want to have include blockers.

-Brad



More information about the Kde-buildsystem mailing list