Opt-in to new Win32 API that allows paths longer than 260 characters
CPack fails when packaging files in a deeply nested tree with total path length greater than 260 characters:
CPack Error: ERROR while packaging files: Error opening "some/long/filepath...": No such file or directory
Globally opting in to the new Win32 API for the entire system fixes the problem (by enabling registry key HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled
on Windows 10 build 1607 or newer) but CMake binaries should opt-in so this registry change is not necessary by enabling the ws2:longPathAware
option in the manifest:
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath
Note that this is somewhat counter to the proposal in #16485