[cmake-developers] the future of FIND_PACKAGE()

Alexander Neundorf neundorf at kde.org
Thu Jun 29 16:36:30 EDT 2006


On Tuesday 27 June 2006 19:59, Alexander Neundorf wrote:
> On Tuesday 27 June 2006 16:51, you wrote:
> > Alexander Neundorf wrote:
>
> ...
>
> > /
> > /usr
> > /usr/local
> > /opt/*
> >
> > will cover most system installations for most distributions.  If a
> > sysadmin or distro adds more prefixes it can put them in a
> > CMAKE_PREFIX_PATH environment variable in /etc/profile for all users to
> > see.  Similarly if users prefixes in their home directories they are
> > responsible for putting the prefix in CMAKE_PREFIX_PATH just like
> > ~/myroot/bin would have to be put in PATH or ~/myroot/lib in
> > LD_LIBRARY_PATH.  We could also consider guessing prefixes from PATH and
> > LD_LIBRARY_PATH environment varibles.
> >
> > On Windows, %ProgramFiles% and the system registry may provide a
> > sufficient set of prefixes.
> >
> > Anyway the point is that CMake should be able to find Foo without Foo
> > finding CMake.
>
> Although I wouldn't see a problem with this, ok
> (for stuff coming with the distro it's no problem, for stuff compiled
> itself with cmake, it's also no problem).
>
> So I think the FooConfig.cmake files should go under lib/ (since they can
> be quite specific) and not under share/.
>
> Leaves the following options:
>
> lib/Foo/cmake/
> lib/cmake/Foo/
>
> pkgconfig basically uses the second form.
> In order to minimize confusion, CMake should IMO support only one of these
> two locations. It should also define exactly the case to be used: "cmake"
> vs. "CMake".
>
> The FIND_PACKAGE() documentation also mentions a version number, maybe this
> could be used as suffix for the subdir name:
> and with version numbers:
>
> lib/Foo-x.y.z/cmake/
> lib/cmake/Foo-x.y.z/
>
> As prefixes I'd suggest to reuse the variables which are used for
> FIND_LIBRARY(). I think introducing more variables should be avoided, it's
> hard to remember them. Reusing the ones from FIND_LIBRARY() would also make
> sense because the FooConfig.cmake files will usually be installed under
> lib/ directory (where also the library itself will be located).
> Also the install prefix of cmake itself should be used (i.e. if cmake is
> installed in a strange location, it will find other stuff installed to the
> same strange location too).
>
> So, which one should be prefered, FindFoo.cmake or FooConfig.cmake if both
> can be found by cmake ?
> I'd say FooConfig.cmake, since this is provided by the project and should
> be more up-to-date/complete/bug fixed/ etc.
>
> How about adding a PATHS argument to FIND_PACKAGE() as there is for all
> other FIND_XXX() commands ?
>
> Bye
> Alex

Comments ?

Bye
Aley
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net



More information about the cmake-developers mailing list