summaryrefslogtreecommitdiffstats
path: root/Source/CPack/cmCPackGenerator.cxx
diff options
context:
space:
mode:
authorOlivier Iffrig <olivier.iffrig@ecmwf.int>2021-03-04 17:04:56 (GMT)
committerBrad King <brad.king@kitware.com>2021-03-05 13:21:13 (GMT)
commitc456b0951370f900615e354ef724a153f607e837 (patch)
treecbfb5285a2c952567b659894a1b4901899330b85 /Source/CPack/cmCPackGenerator.cxx
parent1dde7e350a45638f2154430877a530968708448a (diff)
downloadCMake-c456b0951370f900615e354ef724a153f607e837.zip
CMake-c456b0951370f900615e354ef724a153f607e837.tar.gz
CMake-c456b0951370f900615e354ef724a153f607e837.tar.bz2
CPack: Fix symbolic link detection for directories
In the case where the current path is a symlink to a directory, a trailing slash causes the link to be dereferenced, which means that any subsequent `FileIsSymlink` on it will return false. Fixes: #21886
Diffstat (limited to 'Source/CPack/cmCPackGenerator.cxx')
-rw-r--r--Source/CPack/cmCPackGenerator.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 3db4162..c512a36 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -384,7 +384,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
for (std::string const& gf : this->files) {
bool skip = false;
std::string inFile = gf;
- if (cmSystemTools::FileIsDirectory(gf)) {
+ if (cmSystemTools::FileIsDirectory(gf) &&
+ !cmSystemTools::FileIsSymlink(gf)) {
inFile += '/';
}
for (cmsys::RegularExpression& reg : ignoreFilesRegex) {