[CMake] Pull in project version number from file
Matthew Woehlke
matthew.woehlke at kitware.com
Thu Jun 6 13:05:11 EDT 2013
On 2013-06-06 09:39, Richard Shaw wrote:
> I'm working on converting a small project from autotools to cmake and one
> of the final nit-pick issues is that the version of the software is defined
> in a file, version.h as #defines.
>
> I haven't been able to find the magic incantation of file(READ...,
> string(REGEX MATCH... to parse the version numbers. I did request that the
> version be managed within the cmake config but that was not accepted.
>
> The meaningful entries in version.h are:
>
> #define FREEDV_VERISON_MAJOR "0"
> #define FREEDV_VERSION_MINOR "96"
> #define FREEDV_VERSION_PATCH "3"
> #define FREEDV_VERSION_SUFFIX "Beta"
You might want to look at FindBoost.cmake, which does something similar.
Look for _Boost_VERSION_REGEX (in my version, the relevant code starts
at about line 630).
--
Matthew
More information about the CMake
mailing list