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

Eric Noulard eric.noulard at gmail.com
Tue Feb 4 03:20:10 EST 2014


2014-02-03 Brad King <brad.king at kitware.com>:
> On 02/02/2014 03:49 PM, Stephen Kelly wrote:
>> Should this topic set the CPACK_PROJECT_VERSION variable? Or should cpack
>> first try to read PROJECT_VERSION, and only use CPACK_PROJECT_VERSION as a
>> fallback?
>
> I think it should read CPACK_PROJECT_VERSION and if that is not set
> then try PROJECT_VERSION.  The CPACK_ name is more specific.

+1 this has always been the case: i.e. prefer more specific var if defined.

Have a look at CPack.cmake and you'll see statement like:

cpack_set_if_not_set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")

in the same way you may have CPack generator specific var as well, like:
CPACK_RPM_PACKAGE_NAME.
This last var is used by RPM generator. It gets its default value from
CPACK_PACKAGE_NAME
unless it has been set by the user.

that said "CPACK_PROJECT_VERSION" does not currently exist.
however there is:
CPACK_PACKAGE_VERSION
CPACK_PACKAGE_VERSION_MAJOR
CPACK_PACKAGE_VERSION_MINOR
CPACK_PACKAGE_VERSION_PATCH
currently MAJOR/MINOR/PATCH have a default builtin value "0.1.1".

Those variables define the **package** version which may or may not be the
same as **project/software** version. i.e. the version of the package may
be different as the version of the thing being packaged.

So do you want:

1) to create new "CPACK_PROJECT_VERSION" vars?
    If yes, what is the purpose?

2) feed current "CPACK_PACKAGE_VERSION*" vars with the one found in
CMAKE_PROJECT_VERSION*" ?


If 2) this will change the default behavior (sorry if I loose the
track of default behavior with or without the ploicy).

-- 
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org



More information about the cmake-developers mailing list