Installing data files

Alexander Neundorf neundorf at kde.org
Fri May 28 22:17:50 CEST 2010


On Thursday 27 May 2010, John Layt wrote:
> Hi,
>
> I keep forgetting to add new/changed data files to install to the
> CMakeLists.txt for a number of data file sets I maintain (holidays,
> currencies, locales), so I was thinking of replacing the current explicit
> and long lists of data files to install with something like:
>
> file(GLOB _newfiles plan1/holiday_*)
> install(FILES ${_newfiles}
>         DESTINATION ${DATA_INSTALL_DIR}/libkholidays/plan1)
>
> Is this an acceptable approach to take?  Any gotcha's to look out for?

You can do that, but I always recommend to list all files explicitely.
This way you (and cmake) now exactly what will be installed.

> The other problem I have is that the names of the data files may change
> over time and releases, or may even be deleted, so just installing changed
> files may result in obsolete data files being left installed.  I was
> wondering how this is usually dealt with?  Is there an uninstall function?
>
> I was thinking I could delete the already installed files each time before
> the new set is installed, which seems slightly dodgy to me:
>
> file(GLOB _oldfiles ${DATA_INSTALL_DIR}/libkholidays/plan1/holiday_*)
> if(_oldfiles)
>     file(REMOVE ${_oldfiles})
> endif(_oldfiles)

Hmm, this looks more like a task for package management. I wouldn't do that.

> Again, is this an acceptable thing to do, or is there a better way?
>
> Also, how does this affect packagers, do I need to tell them?

Packagers, what do you say  ?

Alex


More information about the Kde-buildsystem mailing list