kdesupport/decibel

Alexander Neundorf neundorf at kde.org
Mon Nov 10 22:01:30 CET 2008


On Monday 10 November 2008, Dominik Haumann wrote:
> On Monday 10 November 2008, Matthew Woehlke wrote:
> > Dominik Haumann wrote:
> > > Please CC me, as I'm not subscribed to kde-buildsystem.
> >
> > Likewise, I'm on kde-buildsystem but not decibel, please CC either me or
> > buildsystem.
> >
> > > On Saturday 08 November 2008, Dominik Haumann wrote:
> > >> SVN commit 881692 by dhaumann:
> > >>
> > >> fix building Decibel as submodule of kdesupport
> > >
> > > [...]
> >
> > Hey, you fixed my RFE! (https://bugs.kde.org/show_bug.cgi?id=169632)
> >
> > Can I commit this small adjustment also?
> >
> > Index: decibel/CMakeLists.txt
> > ===================================================================
> > --- decibel/CMakeLists.txt      (revision 882361)
> > +++ decibel/CMakeLists.txt      (working copy)
> > @@ -2,7 +2,7 @@
> >   CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
> >   cmake_policy(SET CMP0003 NEW)
> >
> > -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
> > +SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
> > ${CMAKE_MODULE_PATH})

Short answer, yes, I'd say commit.
(but please try to use consistent lower/uppercasing for the commands, it seems 
the other commands are lowercase, so please do it for this one too).

> I don't see a reason to not commit it, although not all modules in
> kdesupport do it:
> not setting it: akonadi decibel eigen2 kdewin32 kdewin-installer phonon qca
> strigi setting it: eigen qimageblitz soprano tapioca

I would recommend to use:
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
                                              ${CMAKE_MODULE_PATH})

This has the effect that the local modules will be preferred over modules in 
other directories already in CMAKE_MODULE_PATH. 
The directories in CMAKE_MODULE_PATH will always anyway be preferred over the 
standard cmake module directory.

If you do 
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
then you override any additional module directories which may have been 
already set earlier. This may not be what you want.

If you do
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} 
                      "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
the local modules are searched after modules in CMAKE_MODULE_PATH. This is 
most probably not what you want.

That said, back to more practical issues.
If you set a cmake variable (not a cache variable), its value will be 
inherited to all subdirectories, but not to parent or "sibling" directories. 
This means the value of CMAKE_MODULE_PATH set in e.g. kdesupport/eigen/ 
doesn't affect the one in kdesupport/eigen2/. So there is no problem there.

Additionally, CMAKE_MODULE_PATH is empty by default. So in practice in many 
cases it doesn't matter at all whether you append it, prepent it or just set 
it, since before that one set() command CMAKE_MODULE_PATH was empty.

BUT there is one big exception, which is if you are building a KDE4 package. 
Then you do find_package(KDE4), which loads FindKDE4.cmake, which sets 
CMAKE_MODULE_PATH to point to the directory where the cmake modules from 
kdelibs are installed. So _after_ doing find_package(KDE4) CMAKE_MODULE_PATH 
is NOT empty.

Alex


More information about the Kde-buildsystem mailing list