[CMake] CPack and mswindows MAX_PATH for temporary work

Mathieu Schroeter schroeter at epsitec.ch
Wed Jun 24 08:12:58 EDT 2015


On 15/06/2015 17:13, Mathieu Schroeter wrote:
> Is MAX_PATH a problem with CPack? I received the following error when 
> the destination is longer than MAX_PATH (here, 264 chars):
>
> CPack Error: Problem copying file: 
> S:/devel/bootstrap-windev/sysroot/toolchain/var/tmp/wpkg/source/epsitec+lydia/usr/share/epsitec/lydia/cache/data/Lydia.Arc.Components/lydia/electrum-arc/components/forms/options/CheckboxField/CheckboxField.styles.js 
> -> 
> S:/devel/bootstrap-windev/sysroot/toolchain/var/tmp/wpkg-8424/build/_CPack_Packages/win64-Source/TGZ/epsitec+lydia_0.1.0.0////usr/share/epsitec/lydia/cache/data/Lydia.Arc.Components/lydia/electrum-arc/components/forms/options/CheckboxField/CheckboxField.styles.js
>
>
>   set(CPACK_SOURCE_GENERATOR "TGZ")
>   set(CPACK_SOURCE_PACKAGE_FILE_NAME "epsitec+lydia_0.1.0.0")
>   include(CPack)
>
>
> If I reduce the longer, it works fine. I've just looked a bit in the 
> sources. It seems that it uses UNC paths then I don't understand.
> I'm using CMake 3.2.3.

Hello,

I've fixed this problem with the following patch:

--- a/Source/cmSystemTools.cxx    Wed Jun 24 13:44:50 2015
+++ b/Source/cmSystemTools.cxx    Wed Jun 24 13:45:01 2015
@@ -1949,14 +1949,14 @@
  {
  #if defined(_WIN32) && !defined(__CYGWIN__)
    cmSystemToolsWindowsHandle hFrom =
-    CreateFileW(cmsys::Encoding::ToWide(fromFile).c_str(),
+ CreateFileW(SystemTools::ConvertToWindowsExtendedPath(fromFile).c_str(),
                  GENERIC_READ, FILE_SHARE_READ, 0,
                  OPEN_EXISTING, 0, 0);
    cmSystemToolsWindowsHandle hTo =
-    CreateFileW(cmsys::Encoding::ToWide(toFile).c_str(),
+ CreateFileW(SystemTools::ConvertToWindowsExtendedPath(toFile).c_str(),
                  GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
    if(!hFrom || !hTo)
      {
      return false;
      }
    FILETIME timeCreation;

It's the cmSystemTools::CopyFileTime function where the paths are not 
converted to UNC.

But now I've an other problem:

CPack Error: Problem while adding file< 
S:/devel/bootstrap-windev/sysroot/toolchain/var/tmp/wpkg-7680/build/_CPack_Packages/win64-Source/TGZ/epsitec+lydia_0.1.0.0/usr/share/epsitec/lydia/cache/data/Lydia.Arc.Components/lydia/electrum-arc/components/forms/options/CheckboxField/CheckboxField.styles.js> 
to archive 
<S:/devel/bootstrap-windev/sysroot/toolchain/var/tmp/wpkg-7680/build/_CPack_Packages/win64-Source/TGZ/epsitec+lydia_0.1.0.0.tar.gz> 
.ERROR =Error opening 
"epsitec+lydia_0.1.0.0/usr/share/epsitec/lydia/cache/data/Lydia.Arc.Components/lydia/electrum-arc/components/forms/options/CheckboxField/CheckboxField.styles.js": 
No such file or directory
CPack Error: Problem compressing the directory
Err: CPack Error: Error when generating package: Project


It seems that there are several MAX_PATH problems with CPack.

Regards,

Mathieu



More information about the CMake mailing list