[CMake] Windows 260 Char Limit Hit with CPack

Eric Noulard eric.noulard at gmail.com
Mon May 21 03:18:55 EDT 2012


2012/5/21 David A. Alexander <alexanda at txcorp.com>:
>
> We are running CPack remotely through Jenkins [1] to end up running a
> build/package process on a Windows 2008 Server machine and are seeing errors
> during the install into the _CPack_Packages directory because file paths
> exceeds the windows 260 character limit [2].  We have seen posts about this
> problem [3] where the solution is to build outside of the source directory,
> but this is not desirable for us because with Jenkins we want to save build
> artifacts and look at the workspace remotely.  For those not familiar with
> Jenkins, the shortest build path starts with...
>
> C:\user_name\jenkins\workspace\project_name\configuration_name\machine_name
>
> And any builds that are put under this base directory are then accessible
> through the web interface, which is very desirable for us.  If we build
> out-of-place, then CPack works, but we don't see any of the build
> information through the Jenkins interface.
>
> We can make all of the names short, but we still run over the 260 character
> because the directories being copied during the install involve many
> subdirectories. This is due to third-party software that we can not control.
>  What we would like is to be able to customize the destination directory for
> the CPack install (i.e. define the _CPack_Packages directory, so that can be
> in something like C:\tmp\_CPack_Package to stay under the 260 character
> limit).
>
> Is there any way to set where the _CPack_Packages directory ends up rather
> than having it under the build directory?  We can build CMake itself and, if
> necessary, patch it to set this property.  In other words, if we can make
> some change/customization in CMake where all of the _CPack_Packages
> directories land under C:\tmp or some other short directory, then that is an
> acceptable solution.  We just need to know what code to change.

You should try

cpack -B "C:\tmp"

it should do exactly what you want, as the doc says:

  -B <package directory>      = override/define CPACK_PACKAGE_DIRECTORY

This may be unclear but
"CPACK_PACKAGE_DIRECTORY" is the base name used by CPack to do all the
packaging.

You should be able to
set(CPACK_PACKAGE_DIRECTORY "C:/tmp") in your CMakeLists.txt as well
then run CPack as usual.

AFAIK it is seldom used so if you encounter any issue with that you
can try to track down
the problem in the source with "git grep CPACK_PACKAGE_DIRECTORY"
and report any bug on the tracker.

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list