Installing data files

Allen Winter allen at kdab.com
Thu May 27 23:11:34 CEST 2010


On Thursday 27 May 2010 4:19:44 pm 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?
> 
> 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)
> 
> 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?
>
I don't think GLOBing does anything to create proper dependencies.
So you need to be a bit careful using it.
 
For just installing data files, I think it seems pretty safe though.



More information about the Kde-buildsystem mailing list