[cmake-developers] RFC: add version to project() call
Alexander Neundorf
neundorf at kde.org
Mon Jan 6 16:41:26 EST 2014
Hi,
on cmake stage I have a simple branch AddVersionToProjectCommand.
This extends the project command to also accept a version number:
project(Foo VERSION 1.2.3 CXX)
All that does is setting some more variables (beside PROJECT_NAME,
PROJECT_SOURCE_DIR, PROJECT_BINARY_DIR and the <projectName>_... equivalents).
When setting a version, you also get PROJECT_VERSION and
PROJECT_VERSION_(MAJOR|MINOR|PATCH|TWEAK) variables as well as the
<projectName>_... equivalents.
These version variables can then be used in other commands/macros/functions
which need a version.
I modified write_basic_package_version_file() accordingly, so that you can now
simply do
project(Foo VERSION 1.2.3)
...
write_basic_package_version_file(FooConfigVersion.cmake
COMPATIBILITY AnyNewerVersion)
and this will use the version number from the project() call automatically (if
no VERSION has been given explicitely).
Comments ?
Alex
More information about the cmake-developers
mailing list