Providing FindFoo.cmake for a kde module "foo"

Andreas Pakulat apaku at gmx.de
Tue Jul 10 10:44:12 CEST 2007


On 09.07.07 22:35:49, Alexander Neundorf wrote:
> On Sunday 08 July 2007 14:53, Andreas Pakulat wrote:
> > On 08.07.07 20:49:23, Ralf Habacker wrote:
> > > Andreas Pakulat schrieb:
> > > > On 08.07.07 19:31:49, Andreas Pakulat wrote:
> > > >> On 08.07.07 11:06:32, Matt Rogers wrote:
> > > >>> On Jul 8, 2007, at 9:35 AM, Andreas Pakulat wrote:
> > > >>>> due to a problem (I'd call it a bug actually) in cmake its not
> > > >>>> possible
> > > >>>> to install 2 kde modules where one depends on the other into
> > > >>>> separate directories (and separate directories from kdelibs). For
> > > >>>> packaging KDE module's however its needed that each module is
> > > >>>> installed into its own prefix.
> > > >>>
> > > >>> You'll need to explain this more clearly. I have no idea what you're
> > > >>> talking about. IIRC, all of KDE needs to be installed in the same
> > > >>> prefix.
> > > >>
> > > >> That would be a regression over KDE3 and is not needed at all (there
> > > >> have recently been some fixes to allow this in the buildsystem).
> > > >
> > > > Ooops, forgot about the more clearly part :)
> > > >
> > > > But during some trials with cmake it turns out that one can tell cmake
> > > > its CMAKE_MODULE_PATH even providing multiple paths:
> > > >
> > > > cmake -DCMAKE_MODULE_PATH="/dir1;/dir2"
> > > >
> > > > So actually this is a non-issue, except the totally wrong error
> > > > message:
> > > >
> > > > CMake Error: KDevPlatform_DIR is not set.  It must be set to the
> > > > directory containing KDevPlatformConfig.cmake in order to use
> > > > KDevPlatform.
> 
> Depends on your definition of "totally wrong", it does what the docs say:
> "If no such file (FindKDevPlatform.cmake) is found, it is expected that the 
> package is another project built by CMake that has a "<name>Config.cmake" 
> file. A cache entry called <name>_DIR is created and is expected to be set to 
> the directory containing this file. If the file is found, it is read and 
> processed by CMake to load the settings of the package. If <name>_DIR has not 
> been set during a configure step, the command will generate an error 
> describing the problem unless the QUIET argument is specified."

Right, sorry for not reading the (excellent) manpage of cmake.

> > > I have added the following stuff to a new file in
> > > <kdelibs-install-dir>/lib/kdevplatform/KDevPlatformConfig.cmake
> > >
> > > if(WIN32)
> > >     file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles)
> > >     SET(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH}
> > > ${ProgramFiles}/kdevplatform/share/apps/cmake/modules)
> > >     find_package(KDevPlatform REQUIRED)
> > > endif(WIN32)
> > >
> > > which let me configure kdevelop on win32 without any error.
> >
> > Hmm.... So we could generate that file and install it along with
> > kdevplatform..
> >
> > Did you need to add the
> > -DKDevPlatform_DIR=<kdelibs-install-dir>/lib/kdevplatform/ ?
> 
> This would be the wrong approach. Creating a <package>Config.cmake file and 
> then telling cmake manually where this file resides doesn't make sense. Then 
> you can also just tell cmake where the stuff itself actually is. 

Except that cmake doesn't have a way to tell it where exactly a
FindFoo.cmake lives as command-line -DCMAKE_MODULE_PATH is not accepted.

Anyway this will - for kde4 projects - be solved in a convenient way.

Andreas

-- 
Tomorrow, this will be part of the unchangeable past but fortunately,
it can still be changed today.


More information about the Kde-buildsystem mailing list