4

I am still a CMake newbie (started learning 3 days ago). In my current CMakeLists.txt, I have the following set directives:

[...]
SET(CPACK_GENERATOR "RPM")
SET(CPACK_PACKAGE_VERSION_MAJOR "3")
SET(CPACK_PACKAGE_VERSION_MINOR "3")
SET(CPACK_PACKAGE_VERSION_PATCH "svn")
SET(CPACK_SYSTEM_NAME "0.el6.x86_64")
[...]

Once I run make package, I got a libcxx-3.3.svn-0.el6.x86_64.rpm.

But IMHO this is "cheating".

According to http://fedoraproject.org/wiki/Packaging:NamingGuidelines#Package_Naming_and_Versioning_Guidelines, ideally I should be able to generate a libcxx-3.3-0.el6.x86_64.rpm instead. But this demands that CPack not to show the CPACK_PACKAGE_VERSION_PATCH.

Nevertheless, according to my trial results, it doesn't seem to be feasible. I would appreciate a hint as to how.

user183394
  • 1,033
  • 1
  • 11
  • 20

1 Answers1

4

Did you try setting CPACK_PACKAGE_FILE_NAME (without the extension) to the desired name? This is provided so that you can define your own package naming scheme if the default does not suit your needs. See http://www.cmake.org/Wiki/CMake:CPackConfiguration for more details on key CPack variables and what they do.

Marcus D. Hanwell
  • 6,716
  • 1
  • 21
  • 20
  • Thanks for the responses. `CPACK_PACKAGE_FILE_NAME` by default has the value `${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}`, so I guess all I have to do is to reset `CPACK_PACKAGE_VERSION` instead? `CPACK_PACKAGE_VERSION` is built from `CPACK_PACKAGE_VERSION_MAJOR`, `CPACK_PACKAGE_VERSION_MINOR`, and `CPACK_PACKAGE_VERSION_PATCH`, AFAICT. – user183394 Apr 07 '13 at 18:18
  • Yeah. Indeed, using the `CPACK_PACKAGE_FILE_NAME` is the only way to do it. Tested with `cmake` 2.8.8. Attempting to set `CPACK_PACKAGE_VERSION` does not seem to take any effect. x-( – user183394 Apr 07 '13 at 21:54
  • You either accept the hardwired logic, or apply your own by manipulating the variable provided. I think this is a reasonably approach, that variable is provided to allow for adjustment of the package file name. – Marcus D. Hanwell Apr 08 '13 at 18:09