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

Alexander Neundorf neundorf at kde.org
Fri Jan 10 15:15:26 EST 2014


On Friday 10 January 2014, Matthew Woehlke wrote:
> On 2014-01-10 11:01, Jean-Christophe Fillion-Robin wrote:
> > Would it make sense to have "project(Foo VERSION 1.2.3)" set the 
variables:
> >    ${PROJECT_NAME}_PROJECT_VERSION_(MAJOR|MINOR|PATCH|TWEAK)
> > 
> > That way, the variable would remain even if project is called with
> > VERSION in sub directory.
> 
> How is that different? Do you mean to drop the PROJECT_VERSION_{...}
> entirely? That doesn't seem desirable for symmetry with the other
> PROJECT_{...} variables.
> 
> I think I'm with Brad; set the PROJECT_VERSION_{...} and
> ${PROJECT_NAME}_VERSION_{...} (note; no extra literal 'PROJECT') as
> usual. Always. Whether or not VERSION was specified (i.e. unset the
> corresponding variables in such case).
> 
> Folks that use the PROJECT_{...} forms hopefully know what they are
> doing, otherwise people are hopefully using the ${PROJECT_NAME}_{...}
> forms instead.
> 
> 
> Related: Do these affect the version properties of libraries? (Because
> OTOH if it does, I can imagine wanting to say VERSION once at the root
> and have it inherit downwards unless overridden. Maybe though that's a
> reason for it to not do so.)

I thought about that too.
Even without it, with the patch you now already have a standard form:

set_target_properties(.... PROPERTIES VERSIOn ${PROJECT_VERSION} )

Automatically doesn't really work, or at least it would have to be switched 
on:
set(CMAKE_USE_PROJECT_VERSION_FOR_LIBRARIES TRUE)
and then that property would automatically use ${PROJECT_VERSION}.

But that doesn't have to be done now, it can also be done later on.

Alex



More information about the cmake-developers mailing list