[CMake] "make package_source" with only symlinks in a subdirectory fails

Andre Naujoks nautsch2 at gmail.com
Fri Aug 29 17:38:59 EDT 2014


On 06.08.2014 12:32, Andre Naujoks wrote:
> Hi.
> 
> I reported this bug to the debian bug-tracker some time ago, but there
> seems to be no activity regarding this.
> So I report this here as well and hope for someone to respond. I created
> a patch (see below), which works for me,
> but might change things in a completely wrong place.
> 
> I am on cmake version 2.8.12.1 (debian version 2.8.12.1-1.6)
> 
> This is the text of the debian bug report
> (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=749892):
> 
> 
> 
> If I try to create a source package with cmake via CPack and "make
> package_source" and there is a directory in the sources, that only
> contains symlinks (only one in my case), the generation of the
> source package fails with:
> 
> CPack Error: Cannot create symlink: <source> --> <destination>
> 
> where source and destination are the file/symlink names of course.
> 
> It seems CPack tries to create the paths for the destination only if
> it copies files and not when creating symlinks.
> 
> The following patch fixes this for me. I don't know, if this is
> actually the right place to put this, but it should point to the
> exact problem.
> 
> 
> diff -Naur cmake-2.8.12.1_orig/Source/kwsys/SystemTools.cxx
> cmake-2.8.12.1/Source/kwsys/SystemTools.cxx
> --- cmake-2.8.12.1_orig/Source/kwsys/SystemTools.cxx	2013-11-05
> 20:07:23.000000000 +0100
> +++ cmake-2.8.12.1/Source/kwsys/SystemTools.cxx	2014-05-30
> 14:25:23.912154919 +0200
> @@ -2835,6 +2835,9 @@
>  #else
>  bool SystemTools::CreateSymlink(const char* origName, const char* newName)
>  {
> +  kwsys_stl::string destination_dir = newName;
> +  destination_dir = GetFilenamePath(destination_dir);
> +  MakeDirectory(destination_dir.c_str());
>    return symlink(origName, newName) >= 0;
>  }
>  #endif
> 
> 
> 
> 
> Regards
>   Andre
> 

Hi again.

Attached is a small example which reproduces the problem.

To reproduce:
- Unpack the attached tar.gz.
- create a "build" directory next to it
- from inside the build directory issue the command:
   cmake ../cmake_make_package_source_error
- then issue:
   make package_source

The following error occurs for me:

Run CPack packaging tool for source...
CPack: Create package using TGZ
CPack: Install projects
CPack: - Install directory:
/home/nautsch/test/cmake_make_package_source_error
CPack Error: Cannot create symlink: tstlnk/thisishello.c--> ../hello.c
CPack Error: Error when generating package: Project
Makefile:75: recipe for target 'package_source' failed
make: *** [package_source] Error 1


Regards
  nautsch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake_make_package_source_error.tar.gz
Type: application/gzip
Size: 416 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140829/e0edddf8/attachment.bin>


More information about the CMake mailing list