0

I am using cpack and Wix to create an MSI installer containing media files.
I am getting catastrophic failure, I read, due to cabinet file exceeding 2GB.
If I understand correctly, I can split the installation package into multiple CAB files.
Simplified CMakeLists.txt:

cmake_minimum_required(VERSION 3.14)
project(content 1.0.0 LANGUAGES CXX)

install(DIRECTORY video
  DESTINATION "."
  FILES_MATCHING REGEX ".+\.(avi|mp4)")

install(DIRECTORY images
  DESTINATION "."
  FILES_MATCHING PATTERN "*.png")

set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/misc/wix_patch.xml")
include(CPack)

I am not sure if it is correct, but I can add more media elements in wix_patch.xml:

<CPackWiXPatch>
    <CPackWiXFragment Id="#PRODUCT">
        <Media Id='2' Cabinet='package1.cab' EmbedCab='no'/> 
        <Media Id='3' Cabinet='package2.cab' EmbedCab='no'/>
    </CPackWiXFragment>
</CPackWiXPatch>

Now the question arises, how can I assign DiskId attribute to files included in the CMake file?
How can I split files into these cabinet files?

If I am correct, in Wix file I would write:

<File Source="./vid.mp4" DiskId="2" />

To assign vid.mp4 file to package2.cab.
How can I achieve that using CPack?

Chris
  • 839
  • 1
  • 12
  • 30
  • [Some comments here on deploying large media files](https://stackoverflow.com/a/53905088/129130). – Stein Åsmul Jun 09 '20 at 12:35
  • Online is not an option and FAT32 is not a concern. I am trying to make use of cpack here. – Chris Jun 10 '20 at 09:22
  • One of the solutions would be to instruct WIX to add to each file in files.wxs DiskId, but I have no idea if it is possible. – Chris Jun 10 '20 at 09:37

1 Answers1

0

Maybe you don't need to deal with cabinet files at all.

Starting from Wix 3.6 you can use <MediaTemplate/> to let Wix automatically generate multiple cabinets. See http://www.joyofsetup.com/2011/06/21/wix-and-cabinetry/

However, to use this with CPack, you have to specify your own template file using CPACK_WIX_TEMPLATE as the default template (https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/Internal/CPack/WIX.template.in) uses <Media/> which cannot coexist with <MediaTemplate/>.