Suggested patch for FindOpenGL.cmake

Paulo Moura Guedes moura at kdewebdev.org
Tue Jun 20 22:48:18 CEST 2006


On Tuesday 20 June 2006 21:36, Brad King wrote:
> 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.

You're so right, FOO_FIND_INCLUDED is what we need :)
Coudn't CMake not do this automatically but have an option to set this 
behavior on?

Paulo


More information about the Kde-buildsystem mailing list