[cmake-developers] RFC: add version to project() call
Matthew Woehlke
mw_triad at users.sourceforge.net
Wed Jan 15 16:27:45 EST 2014
On 2014-01-15 16:25, Alexander Neundorf wrote:
> On Wednesday 15 January 2014, Alexander Neundorf wrote:
>> And, to actually produce the breakage, at some place the VERSION argument
>> must have been added.
>> With the current state of my branch, this could be worked around by
>> unsetting the guard variable:
>>
>>
>> project(Foo VERSION 1.2.3)
>> ....
>>
>> unset(CMAKE_PROJECT_VERSION_SET_BY_PROJECT_COMMAND)
>> add_subdir(B)
>>
>> This way B would be protected from that change in behaviour.
>
> I could also add more logic, to try to detect if PROJECT_VERSION has been set
> manually, e.g. project() could reset PROJECT_VERSION only if it has the same
> value as ${${ParentProjectName}_VERSION}. Then it would only break if there
> was a manual set(PROJECT_VERSION ...) before a project() call without VERSION,
> and if that manually set version was the same as the version in the "parent
> project".
IMHO your last suggestion (very good idea, btw!) is more than adequate,
especially given the original weakness of my "objection" (which was
always more along the lines of "did you consider this case, and should
we worry about it?").
--
Matthew
More information about the cmake-developers
mailing list