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

John Drescher drescherjm at gmail.com
Wed Jan 12 06:03:51 EST 2011


> 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.
>

Are you using source control?

I use a combination of version in the main CMakeLists.txt and the svn
rev. Variables from these get into a generated project header file
that is also generated in the main CMakeLists.txt

John


More information about the CMake mailing list