MantisBT - CMake
View Issue Details
0013787CMakeCPackpublic2012-12-12 06:542013-10-07 10:09
Jesus Malo Poyatos 
Clinton Stimpson 
normalminoralways
closedfixed 
Windows
CMake 2.8.10.2 
 
0013787: Wrong default value of CPACK_PACKAGE_INSTALL_REGISTRY_KEY
As far as I could found, the default value of CPACK_PACKAGE_INSTALL_REGISTRY_KEY should be "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}" (see http://www.cmake.org/pipermail/cmake/2010-September/039663.html [^]), however if you look at CPack.cmake, you will find the following (line 381):
    cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
      "${CPACK_PACKAGE_INSTALL_DIRECTORY}")

Is it intentionally?
BTW, the documentation of CPACK_PACKAGE_INSTALL_REGISTRY_KEY is incomplete (no default value explained) at http://www.cmake.org/cmake/help/v2.8.10/cpack.html#variable:CPACK_PACKAGE_INSTALL_REGISTRY_KEY [^]
No tags attached.
Issue History
2012-12-12 06:54Jesus Malo PoyatosNew Issue
2012-12-12 08:31Clinton StimpsonNote Added: 0031870
2012-12-12 08:45Eric NOULARDNote Added: 0031871
2013-05-09 21:28Craig ScottNote Added: 0033015
2013-05-09 22:09Clinton StimpsonNote Added: 0033016
2013-05-09 22:14Craig ScottNote Added: 0033017
2013-05-14 00:24Clinton StimpsonAssigned To => Clinton Stimpson
2013-05-14 00:24Clinton StimpsonStatusnew => assigned
2013-05-14 00:24Clinton StimpsonNote Added: 0033035
2013-05-14 00:24Clinton StimpsonStatusassigned => resolved
2013-05-14 00:24Clinton StimpsonResolutionopen => fixed
2013-10-07 10:09Robert MaynardNote Added: 0034047
2013-10-07 10:09Robert MaynardStatusresolved => closed

Notes
(0031870)
Clinton Stimpson   
2012-12-12 08:31   
Did you notice the default value of CPACK_PACKAGE_INSTALL_DIRECTORY is "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}"?

If you take the defaults, it is the same.

If CPACK_PACKAGE_INSTALL_DIRECTORY is overridden, the registry key corresponds with the install location. If you have a newer installer with a newer version, but the same install location, the same registry key can be used. This avoids stale uninstall entries for older versions, if they weren't uninstalled first.
(0031871)
Eric NOULARD   
2012-12-12 08:45   
Concerning the "incomplete" documentation aspect
I would kindly review and possibly merge any CPack documentation patch.

Do not hesitate to submit documentation patch, then!!
(0033015)
Craig Scott   
2013-05-09 21:28   
Sorry if this is somewhat hijacking this issue, but it seems relevant. Clinton's comment about a newer installer having the same registry key highlights a potential issue with the current default for CPACK_PACKAGE_INSTALL_REGISTRY_KEY. The package version is included in the default value, so a newer version will have a different registry key. Won't this mean the update mechanism for NSIS won't recognise the packages as the same with the later one being a more recent version which should replace the previous version?
(0033016)
Clinton Stimpson   
2013-05-09 22:09   
You highlighted the exact reason why the default is set to follow the installation directory.

cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
  "${CPACK_PACKAGE_INSTALL_DIRECTORY}")

If the install directory of "MyProduct 1.0.0" and "MyProduct 1.0.1" both install into a directory "MyProduct 1.0", then the registry key is the same. In other words, the registry key follows the installation directory by default.

Or did I misunderstand you, and you are saying there is a problem with that?
(0033017)
Craig Scott   
2013-05-09 22:14   
Probably me misunderstanding you rather than the other way around. ;) So if CPACK_PACKAGE_INSTALL_DIRECTORY is set and remains the same, installing a later version of a package should replace an earlier version? That's the behaviour we want and my earlier question was more querying whether this was indeed the current behaviour. I'd been assuming it was behaving that way but reading your comment made me second-guess myself. :b

So basically, if you never explicitly set CPACK_PACKAGE_INSTALL_REGISTRY_KEY but you do set CPACK_PACKAGE_INSTALL_DIRECTORY to the same value for all versions of your package, updates behave as expected by replacing earlier versions.
(0033035)
Clinton Stimpson   
2013-05-14 00:24   
3fde03c Improve documentation for CPACK_PACKAGE_INSTALL_REGISTRY_KEY.
(0034047)
Robert Maynard   
2013-10-07 10:09   
Closing resolved issues that have not been updated in more than 4 months.