[cmake-developers] RFC: add version to project() call

Brad King brad.king at kitware.com
Fri Jan 10 09:49:03 EST 2014

On 01/06/2014 04:41 PM, Alexander Neundorf wrote:
> 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).

One problem left to address is what to do when a project() command is
invoked in a subdirectory.  It will set PROJECT_NAME, PROJECT_SOURCE_DIR,
and PROJECT_BINARY_DIR but it should also *unset* the PROJECT_VERSION_
variables if no VERSION argument is provided.  Otherwise the version
values will not be consistent with the project name.


More information about the cmake-developers mailing list