CMake check for create-resources

Alexander Neundorf neundorf at kde.org
Wed Feb 13 20:06:18 CET 2008


On Wednesday 13 February 2008, you wrote:
> On Feb 12, 2008 6:28 PM, Alexander Neundorf <neundorf at kde.org> wrote:
> > On Tuesday 12 February 2008, Sven Langkamp wrote:
> > > Hi,
> > >
> > > I want to add a dependency for the create-resources package to KOffice,
> > > which contains shared resources from the CREATE project.
> > > How can I check if the package is installed? Note that the package only
> > > contains data and no code.
> >
> > What does this package consist of and where is it typically installed ?
> > You probably need to do something with find_path().
>
> On my system it's in /usr/share/create/ and it contains brush, pattern and
> gradient files.
>
> I tried to put a FindCreateResources.cmake in koffice/cmake/modules, but
> that doesn't work and is probably not even valid cmake code:
>
> if(CREATERESOURCES_INCLUDE_DIR)
>
>   set(CREATERESOURCES_FOUND TRUE)
>
> else(CREATERESOURCES_INCLUDE_DIR)
>
>   find_path( CREATERESOURCES_INCLUDE_DIR simple.kgr /usr/share/create/ )
>   if( CREATERESOURCES_INCLUDE_DIR )
>     set( CREATERESOURCES_FOUND TRUE )
>   endif( CREATERESOURCES_INCLUDE_DIR )
> endif(CREATERESOURCES_INCLUDE_DIR)
>
> find_package(createresources REQUIRED) gives CMake Error:
> createresources_DIR is not set.  It must be set to the directory containing
> createresourcesConfig.cmake in order to use createresources.

The filename is FindCreateResources.cmake, so must use exact that case:
find_package(CreateResources)

I'd suggest to start simple:

find_path( CREATERESOURCES_INCLUDE_DIR simple.kgr 
           PATHS 
           ${CMAKE_INSTALL_PREFIX}
           /usr /usr/local /usr/pkg
           /opt /opt/local /opt/csw
           PATH_SUFFIXES share/create )

if( CREATERESOURCES_INCLUDE_DIR )
  set( CREATERESOURCES_FOUND TRUE )
endif( CREATERESOURCES_INCLUDE_DIR )

(with cmake cvs it wouldn't be necessary to list all these paths, there it has 
CMAKE_SYSTEM_PREFIX_PATH which has all these search prefixes)

Does that project have a homepage ?

Alex


More information about the Kde-buildsystem mailing list