@@ -14,7 +14,11 @@ set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
1414# This should always be set, just isn’t by default for awkward backward compatibility reasons
1515set (CPACK_VERBATIM_VARIABLES YES )
1616
17- set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR} /LICENSE" )
17+ # The WiX package generator expects licenses to end in .txt or .rtf...
18+ file (COPY "${CMAKE_CURRENT_SOURCE_DIR} /LICENSE" DESTINATION "${CMAKE_CURRENT_BINARY_DIR} " )
19+ file (RENAME "${CMAKE_CURRENT_BINARY_DIR} /LICENSE" "${CMAKE_CURRENT_BINARY_DIR} /LICENSE.txt" )
20+
21+ set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR} /LICENSE.txt" )
1822set (CPACK_PACKAGE_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR} /README.md" )
1923
2024# Automatically find dependencies for shared libraries
@@ -23,9 +27,41 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES)
2327# In addition, we depend on gcc for preprocessing
2428set (CPACK_DEBIAN_PACKAGE_DEPENDS gcc)
2529
30+ # For windows we need to set up product and update GUID
31+ # See: https://docs.microsoft.com/en-us/windows/win32/msi/productcode
32+ # and https://docs.microsoft.com/en-us/windows/win32/msi/upgradecode
33+ # confusingly, the "product" GUID here is the one that changes between releases,
34+ # the upgrade one is the one that stays the same. CMake takes care of setting these,
35+ # but we want to fix the upgrade GUID to a specific value so new installs override
36+ # old ones.
37+ set (NIL_UUID "00000000-0000-0000-0000-000000000000" )
38+ string (UUID CPACK_WIX_UPGRADE_GUID
39+ NAMESPACE ${NIL_UUID}
40+ NAME "cprover-cbmc"
41+ TYPE SHA1
42+ UPPER)
43+
44+
45+ # This is AFAICT only used for windows installers.
46+ # Basically the package-specific part of the install directory,
47+ # e.g. C:\Program Files\${CPACK_PACKAGE_INSTALL_DIRECTORY}.
48+ # The default here includes the version number which we don't want,
49+ # because upgrades will overwrite the files here so we could be in the
50+ # odd situation where C:\Program Files\cbmc-5.12.6\bin\cbmc --version
51+ # gives you back "5.16.1" because 5.12.6 just happened to be the first
52+ # installed version.
53+ set (CPACK_PACKAGE_INSTALL_DIRECTORY "cbmc" )
54+
55+
2656# TODO packages for other platforms
2757if (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
2858 set (CPACK_GENERATOR TGZ DEB)
59+ elseif (WIN32 )
60+
61+ # On windows we need to make sure to ship the
62+ # MSVC redistributable
63+ include (InstallRequiredSystemLibraries)
64+ set (CPACK_GENERATOR ZIP WIX)
2965endif ()
3066
3167# Yes, this has to go at the bottom,
0 commit comments