overriding CMAKE_MODULE_PATH

Andreas Pakulat apaku at gmx.de
Tue Aug 17 07:26:46 CEST 2010


On 16.08.10 23:54:51, Michael Jansen wrote:
> On Monday 16 August 2010 21:09:46 Alexander Neundorf wrote:
> 
> I kind of get unwilling to discuss it. So here is my last attempt.
> 
> > > 3. If someone develops a small lib he plans to add as a kde dependency
> > > he probably installs it into some non distro prefix so he doesn't need
> > > root rights to install it. So he needs to override CMAKE_MODULE_PATH in
> > > say koffice to make it pick up that location.
> > 
> > No.
> > I don't understand.
> > There is no need to override CMAKE_MODULE_PATH.
> > If he installs libfoo to $HOME/my/installs/ then all he needs to do so
> > others can find it is to $ export CMAKE_PREFIX_PATH=$HOME/my/installs:
> > $CMAKE_PREFIX_PATH
> 
> CMAKE_PREFIX_PATH does not influence the way cmake finds FindXYZ*.cmake files. 
> 
> So if a a developer develops the file FindXYZ*.cmake locally with the intent 
> to somedayy put it upstream then CMAKE_MODULE_PATH is a development tool too. 
> It allows to develop and install a FindXYZ*.cmake tool without root rights and 
> still beeing able to find it.

Alex point is that only cmake itself should be installing FindXYZ.cmake
files (and cmake knows where to find those, always), anything else
should be considered a bug in the module installing the find-module.
Going by that means there's no need to adjust CMAKE_MODULE_PATH because
at most a project needs to add cmake/modules or whereever its
find-modules are to it. 

> And if the next paragraph doesn't convince you i really have no idea anymore. 
> This lines are cited from an email you wrote today.
> 
>   Adjust CMAKE_MODULE_PATH to find FindBlub.cmake or set Blub_DIR to the
>   directory containing a CMake configuration file for Blub. 
>   [...]
> 
> Which won't work with most kde modules because they immediately overwrite it. 

No it will work, you can add the path to the existing line setting
CMAKE_MODULE_PATH in the cmakelists.txt and that'll work, just like the
message from cmake says :)

Changing the cmake-module-path encourages projects to install
FindXYZ.cmake instead of trying to upstream that module (because copying
it around is painful) which is generally rather easy these days. Not to
mention that installing it to <prefix>/share/apps/cmake/modules is
wrong, a project should install to share/apps/<project>/modules or
something, else you risk overwriting a file that some other project also
installs which will upset distro's a lot.

> And absolutely and totally makes no sense, breaks stuff and is a surefire 
> symbol for the upcoming apocalypse judging from most comments i read today.

The apocalypse is because projects are installing find-modules and think
this is ok. Its not, thats what needs to be fixed.

Andreas

-- 
Don't you feel more like you do now than you did when you came in?


More information about the Kde-buildsystem mailing list