On Sun, Jun 5, 2011 at 4:44 PM, Alexander Neundorf <neund...@kde.org> wrote:

> On Sunday, June 05, 2011 11:50:50 PM Eric Noulard wrote:
> > 2011/6/4 Alexander Neundorf <neund...@kde.org>:
> > > Hi,
> > >
> > > again from the KDE sprint...
> > >
> > > 1) We have a macro
> > > macro_optional_find_package().
> > > The purpose is to be able to build without a specific package even if
> > > that package is installed and would actually be found by the
> > > find_package() call.
> > >
> > > Basically this is a wrapper around find_package(), but additionally it
> > > adds an option WITH_Foo, which is enabled by default.
> > > If disabled, the actual find_package() is not executed, and the
> variables
> > > FOO_FOUND/INCLUDES/LIBRARIES are reset to empty, so that even if the
> > > package hasn't been searched this time, results from previous runs are
> > > discarded.
> > >
> > > What do you think about adding this as a built-in feature to
> > > find_package(), i.e. add a argument OPTIONAL to find_package(), then
> > > probably also a "COMMENT".
> >
> > I'm not sure about this feature and since we already have REQUIRED why
> > would be the meaning of OPTIONAL?
>
> Using OPTIONAL and REQUIRED together should be considered an error.
> OPTIONAL means you can disable the searching so that it will also not be
> "found" even if it is actually installed.
>
> > May be some syntax like
> >
> > find_package(Foo IF <VarName>) would be clearer.
> >
> > find_package(Foo IF  BUILD_WITH_Foo)
> >
> > would create option BUILD_WITH_Foo
> > (default value would the value of BUILD_WITH_Foo_Default var or ON if
> > it is not defined)
> > and the search of the package will be done iff the option is ON.
>
> Maybe.
> I thought OPTIONAL would be good since it hints at "OPTION", and it is an
> option which is created for disabling it.
> Could also be "OPTION" instead of "OPTIONAL".
>
> ...
> > > Both have been proven useful, the one for find_package() especially for
> > > packagers.
> >
> > Agreed, the feature is nice I use similar thing with hand-crafted
> > option in some project.
>
> Alex
> _______________________________________________
> cmake-developers mailing list
> cmake-developers@cmake.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>

I think the use of OPTIONAL to specify "Add CMake option to not look for
this package" kind of confusing.  I would prefer a more verbose, but clear
flag.  Something like:

ADD_CMAKE_OPTION_TO_DISABLE

James
_______________________________________________
cmake-developers mailing list
cmake-developers@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to