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

Alexander Neundorf neundorf at kde.org
Wed Jan 29 15:35:47 EST 2014


On Wednesday 29 January 2014, Brad King wrote:
> On 1/28/2014 4:20 PM, Alexander Neundorf wrote:
> >> (1) Design new behavior in a way that requires a change to the
> >> 
> >>     project to activate.
> > 
> > I think my current version fits (1).
> 
> Yes, I meant to add "like Alex's topic currently does".
> 
> > IMO this is not the place for a policy, since the behaviour of the
> > existing, unchanged project did not change, it is still working as it
> > did before.
> 
> ...except for the case of set(PROJECT_VERSION) *before* a call to
> project() without a VERSION.  Currently your solution using
> CMAKE_PROJECT_VERSION_SET_BY_PROJECT_COMMAND avoids needing the
> policy.  However, it is not a design that would have been
> produced if we were starting from scratch.  The purpose of a
> policy is to allow us to switch to the clean design while
> remaining compatible with existing code.
> 
> > Regarding (2): how should I detect whether PROJECT_VERSION has been set
> > manually ?
> 
> Actually I realized we don't have to detect that.  What matters
> is that project() may clear the variable values when it did not
> before.
> 
> I reverted the 'AddVersionToProjectCommand' topic from 'next'
> and replaced it with a 'project-version-variables' topic that
> adds a policy:
> 
>  Help: Format project command and variable documentation
>  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=00007dcc
> 
>  project: Add optional LANGUAGES keyword
>  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=16d040c9
> 
>  project: Manage VERSION variables
>  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7e142c5a
> 
>  write_basic_package_version_file: use PROJECT_VERSION
>  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=41d2f2c4
> 
> The key is that project() only accepts VERSION when the
> policy is set to NEW.  After release this will be automatic
> because one would need cmake_minimum_required() to specify a
> high enough version to understand the new project() signature
> and that would set the policy to NEW.  Once the policy is
> set to NEW then we can freely clear variables when project()
> is not given a VERSION.

Fine with me, thanks :-)

Alex



More information about the cmake-developers mailing list