Skip to content

Commit 84af42b

Browse files
committed
Configure NSIS-packaged CMake version and install destination
Remove the version number from the default package install destination. An unversioned default allows users to upgrade their CMake installations without manually re-generating all their build trees to update the path to CMake. Users can select a versioned directory name on installation if they wish. Also name the package with the full CMake version number so it is clear exactly what version is going to be installed. This is particularly helpful for the nightly binary installers.
1 parent 7655029 commit 84af42b

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

CMakeCPack.cmake

+5-9
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,23 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
2929
set(CPACK_PACKAGE_VENDOR "Kitware")
3030
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
3131
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
32+
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
3233
set(CPACK_PACKAGE_VERSION "${CMake_VERSION}")
33-
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
34+
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
3435
set(CPACK_SOURCE_PACKAGE_FILE_NAME "cmake-${CMake_VERSION}")
3536

36-
# Make this explicit here, rather than accepting the CPack default value,
37-
# so we can refer to it:
38-
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
39-
4037
# Installers for 32- vs. 64-bit CMake:
4138
# - Root install directory (displayed to end user at installer-run time)
4239
# - "NSIS package/display name" (text used in the installer GUI)
4340
# - Registry key used to store info about the installation
4441
if(CMAKE_CL_64)
4542
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
46-
set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} (Win64)")
47-
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} (Win64)")
43+
set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} (Win64)")
4844
else()
4945
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
50-
set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
51-
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
46+
set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
5247
endif()
48+
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_NSIS_PACKAGE_NAME}")
5349

5450
if(NOT DEFINED CPACK_SYSTEM_NAME)
5551
# make sure package is not Cygwin-unknown, for Cygwin just

0 commit comments

Comments
 (0)