trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: March 2012

Modify cmake process to update a source file before building

From: Darrell Anderson <humanreadable@...>
Date: Thu, 8 Mar 2012 13:45:54 -0800 (PST)
I am creating three new entities for the TDE help files. The entities will be stored in the sources tree in tdelibs/kdoctools/customization/entities/general.entities.

These new entities will contain the document version, release date, and copyright years.

The past practice with all KDE3 help files was to use hard-coded, static text strings. I want to change the fixed text to entities so they can be dynamic and always match the TDE release information.

Conceptually, I tested these new entities by hard-coding them into general.entities and compiling a couple of modified docbook sources to use those entities. Works as planned. :)

The next step is to modify the cmake build process to update the general.entities file when the tdelibs package is built.

The macro or script, whichever is correct terminology for cmake, needs to work like this:

* Extract the release version variable TDE_VERSION_STRING from tdelibs/tdecore/tdeversion.h.

* Read the file date stamp of tdeversion.h (for GIT sources this will change regularly, for tarballs this will remain fixed)

* Create a copyright year string in the form of "2010-$CURRENT_YEAR"

* Update the text strings between the quotation marks in general.entities:

<!ENTITY tde-release-version "R14.0.0 [DEVELOPMENT]">
<!ENTITY tde-release-date "March 8, 2012">
<!ENTITY tde-copyright-date "2010-2012">

* Continue with the build process.

I think I can do something like that in a shell script but I am unfamiliar with how to do the same in cmake.

I don't mind doing the grunt work and testing, but I appreciate guidance to do this.

Thanks!

Darrell