Changed behavior of CPACK_PACKAGE_VERSION generation?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Changed behavior of CPACK_PACKAGE_VERSION generation?

Björn Blissing
Hi,

Today we discovered that our generated CPACK_PACKAGE_VERSION variables were broken.
This is probably related to us updating to a newer version of CMake.

Previously we generated this variable by setting the CPACK_PACKAGE_VERSION_MAJOR and CPACK_PACKAGE_VERSION_MINOR to fixed values, while CPACK_PACKAGE_VERSION_PATCH was set to variable name.
This name was then replaced by running a custom target just before building. In this target the variable name got replaced with the current SVN revision number. This have worked the last years, but now the variable name just gets omitted when we run "generate" in CMake.

A short example:
================
cmake_minimum_required(VERSION 2.8.9)
project (hello)
add_executable(hello helloworld.cpp)
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "REPLACEME")
include(CPack)

Would result in the following strings in CPackConfig.cmake:
-----------------------------------------------------------
set(CPACK_PACKAGE_VERSION "1.0.REPLACEME")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "REPLACEME")


But with the CMake 3.12.2 this will be:
---------------------------------------
set(CPACK_PACKAGE_VERSION "1.0")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "REPLACEME")


So our CPACK_PACKAGE_VERSION will omit the variable name, which in turn makes our custom target to fail.

Our quick fix was to add the following line to our CMakeList.txt file:
SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")

My question is: Is this change of behavior intended? Are only numbers allowed to be part of the CPack version variable?

Regards
Björn Blissing



--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake