[CMake] Building a Version Header

Johannes Stallkamp johannes.stallkamp at rub.de
Fri Jul 9 03:06:13 EDT 2010


Hi,

Am 08.07.2010 22:31, schrieb Tyler Roscoe:
> On Wed, Jul 07, 2010 at 10:43:15PM -0400, John Drescher wrote:
>> On Wed, Jul 7, 2010 at 9:44 PM, Clark Gaebel <cg.wowus.cg at gmail.com>
wrote:
>>> I would like to generate file that looks something like this:
>>>
>>>    // version.h
>>>    #define VERSION "v0.1-345-ga77ede8"
>>
>> You want to do that with configure_file
>
> The upside of this approach is that it's simple. The downside is that it
> is only run (and thus your version header is only updated) whenever
> CMake runs. It's possible for the source code to change without
> triggering a re-run of CMake.
We use a custom command to check the SVN revision via a CMake script.
I then let the target depend on this project. Within the script, the
version header will only be updated if the revision actually changed.
Thus, the target is recompiled if and only if  the SVN revision changed.

Johannes

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100709/b455aa84/attachment.htm>


More information about the CMake mailing list