summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2015-01-29 16:52:30 (GMT)
committerBrad King <brad.king@kitware.com>2015-01-30 15:08:12 (GMT)
commit4dc5acee634b3ac72f2e1c2f1ca0489526a86cf3 (patch)
tree629478913d664a9673f7d8d871792f68e631f092 /Source/CPack
parent57622bd19d3fd013038d34f497b106a7e2bfd26d (diff)
downloadCMake-4dc5acee634b3ac72f2e1c2f1ca0489526a86cf3.zip
CMake-4dc5acee634b3ac72f2e1c2f1ca0489526a86cf3.tar.gz
CMake-4dc5acee634b3ac72f2e1c2f1ca0489526a86cf3.tar.bz2
CPack: Fix packaging of source tarballs with symbolic links
When staging the package installation, if the first file in a directory happens to be a symbolic link, make sure we create the directory before trying to create the link.
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackGenerator.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 84e6482..8139d29 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -437,6 +437,18 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: "
<< symlinkedIt->second << "--> "
<< symlinkedIt->first << std::endl);
+ // make sure directory exists for symlink
+ std::string destDir =
+ cmSystemTools::GetFilenamePath(symlinkedIt->second);
+ if(!destDir.empty() && !cmSystemTools::MakeDirectory(destDir))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot create dir: "
+ << destDir
+ << "\nTrying to create symlink: "
+ << symlinkedIt->second << "--> "
+ << symlinkedIt->first
+ << std::endl);
+ }
if (!cmSystemTools::CreateSymlink((symlinkedIt->first).c_str(),
(symlinkedIt->second).c_str()))
{