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

Andre Naujoks nautsch2 at gmail.com
Wed Aug 6 06:32:24 EDT 2014


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


More information about the CMake mailing list