[CMake] How to assign version numbers from a source header to CMake variables?

Alexey Livshits livchits at web.de
Wed Jan 12 07:30:53 EST 2011


2011/1/12 SF Markus Elfring <elfring at users.sourceforge.net>:
> Hello,
>
> I would like the add the CMake approach for software generation to a
> project. My project example supports also other build tools.
> This has got consequences on the way how informations like version numbers
> are shared between these approaches.
>
> The CMake tutorial describes components for the desired solution (in the
> section "Adding a Version Number and Configured Header File").
> http://cmake.org/cmake/help/cmake_tutorial.html
>
> I imagine to add a specific header file that will contain the shared data in
> the format of the source programming language. This will be a few C/C++
> preprocessor definitions.
> Now I would like to know how to get these informations into CMake variables
> for further reuse. I would appreciate your advices.
>
> Regards,
> Markus

Hello Markus,
I use a simple text file with the build number, which is tracked under
VCS. During the build I parse it, generate my version header, increase
the number, save it to the file and check it in. Maybe this could be
helpful for you.
-- 
BG,
Alexey


More information about the CMake mailing list