summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-03-27 14:22:52 -0400
committerBrad King <brad.king@kitware.com>2019-03-27 14:22:52 -0400
commit52bb1760ff654e2bfaec708ccf143fd1b0f8cd37 (patch)
treea4c36aab905b1448e47c2a42fc01049cffcf3202
parent97c163f5f7bd9c056b6ca0dd03f1b239ff61764b (diff)
parentce180cf810841ccc813ba7becc8043dd426fc966 (diff)
downloadcmake-52bb1760ff654e2bfaec708ccf143fd1b0f8cd37.tar.gz
Merge branch 'backport-kwsys-SystemTools-copy-self' into release-3.14
Merge-request: !3145
-rw-r--r--Source/kwsys/SystemTools.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index cbdfe11759..d8904fed73 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2307,10 +2307,6 @@ static bool CloneFileContent(const std::string& source,
bool SystemTools::CopyFileAlways(const std::string& source,
const std::string& destination)
{
- // If files are the same do not copy
- if (SystemTools::SameFile(source, destination)) {
- return true;
- }
mode_t perm = 0;
bool perms = SystemTools::GetPermissions(source, perm);
std::string real_destination = destination;
@@ -2331,6 +2327,10 @@ bool SystemTools::CopyFileAlways(const std::string& source,
} else {
destination_dir = SystemTools::GetFilenamePath(destination);
}
+ // If files are the same do not copy
+ if (SystemTools::SameFile(source, real_destination)) {
+ return true;
+ }
// Create destination directory