[CMake] find_package question

Daniel Nelson torham at connect2.com
Sat Apr 11 07:36:58 EDT 2009


On Friday 10 April 2009 2:59:11 pm Alexander Neundorf wrote:
> On Friday 10 April 2009, Robert Dailey wrote:
> > I'm reading the guidelines for find package modules here:
> > http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/readme.txt?root=CMake&vi
> >ew =markup
> >
> > No where in here do I see any mention of "uppercase" variable names. For
> > example, if my find package is:
> >
> > FindFoo.cmake
> >
> > My return variables are:
> >
> > Foo_LIBRARIES
> > Foo_INCLUDE_DIRS
> > Foo_FOUND
> >
> > However, FindPackageHandleStandardArgs.cmake makes the FOUND variable all
> > upper case, like so:
> >
> > FOO_FOUND
> >
> > What am I supposed to do? Uppercase or not? I notice that some
> > pre-packaged find modules (like boost) do not use uppercase names, while
> > others (like OpenGL) do use uppercase.
>
> Use uppercase, it's the majority of modules.
>
> Alex

When you call find_package(),  variables can be set inside the find script for 
arguments such as QUIET or REQUIRED.  For FindFoo.cmake, these variables would 
be Foo_FIND_QUIETLY and Foo_FIND_REQUIRED respectively.  I think it's ugly and 
confusing having some variable all in caps and others with a strange mixture 
of CamelCase and caps.  Further a strict reading of Modules/readme.txt 
indicates that for a script FindFoo.cmake the variable set should be 
Foo_FOUND.  So it seems to me that the find script itself really should be 
named in all caps, i.e. FindFOO.cmake.

As things are now, most scripts are named FindFoo.cmake and most of them set 
FOO_FOUND.
--
Daniel




More information about the CMake mailing list