[CMake] Question about find_library()

Philip Lowman philip at yhbt.com
Fri Mar 27 14:00:56 EDT 2009


On Fri, Mar 27, 2009 at 1:29 PM, Alexander Neundorf <a.neundorf-work at gmx.net
> wrote:

> On Friday 27 March 2009, Philip Lowman wrote:
> > On Thu, Mar 26, 2009 at 10:23 PM, Robert Dailey <rcdailey at gmail.com>
> wrote:
> > > I'm assuming that the macro in question will automatically mark all
> cache
> > > variables as advanced. Is this the case?
> > >
> > > @Mike Jackson
> > > Thank you for this info. I forgot about that function.
> > >
> > > There seems to be an inconsistency in naming convention. For example,
> the
> > > set() function uses the term INTERNAL to represent a "hidden" cache
> > > variable. However, the function mark_as_advanced() is using the term
> > > "advanced". What I would like to see is one of the following pairs:
> > >
> > > set( CACHE ADVANCED )
> > > mark_as_advanced()
> > >
> > >  - OR -
> > >
> > > set( CACHE INTERNAL )
> > > mark_as_internal()
> > >
> > > Does this make sense, or am I misunderstanding the difference between
> the
> > > two?
> >
> > You can consider INTERNAL "super advanced".  It won't get shown in the
> > cache editor at all.  I think if you want an internal cache variable it
> > probably should be created as an INTERNAL.  In general you probably want
> to
> > avoid using INTERNAL unless you really need it.  Think of INTERNAL as a
> > friendlier way to use set(...FORCE CACHE).  Basically you're setting a
> > cache variable you want to be persistent, but you don't want to confuse
> the
> > user into thinking they have a choice in changing it.
> >
> > Marking a variable as advanced is more of a discretionary thing.
>  Generally
> > when writing a find module a good rule of thumb is do not
> > mark_as_advanced() by default.  Generally, leave the user calling
> > find_package() to do this and assume they care about the location of the
> > library.
>
> I think I have to object here.
> AFAIK the CMake devs prefer to basically use mark_as_advanced() by default
> for
> all results from find_library/program/path/file() in find-modules, and only
> keep those entries visible in the simple view which should be
> user-adjustable.
> E.g. for FindQt4.cmake I think the only non-advanced variable is
> QT_QMAKE_EXECUTABLE, since this is the one which basically decides about
> all
> other variables.
> Or options which adjust how the project will be built should be
> non-advanced.
>

I stand corrected.  Far more find modules than I expected use
mark_as_advanced() to at least some extent.

$ grep -i mark_as_advanced Find* | cut -f1 -d : |sort |uniq |wc
     71      71    1219
$ ls -1 Find* |wc
    120     120    2114

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090327/6db8a033/attachment.htm>


More information about the CMake mailing list