summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmake.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 3f6143a..7edf2ea 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1072,6 +1072,22 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
// supporting them.
else if (args[1] == "create_symlink" && args.size() == 4)
{
+ const char* destinationFileName = args[3].c_str();
+ if ( cmSystemTools::FileExists(destinationFileName) )
+ {
+ if ( cmSystemTools::FileIsSymlink(destinationFileName) )
+ {
+ if ( !cmSystemTools::RemoveFile(destinationFileName) ||
+ cmSystemTools::FileExists(destinationFileName) )
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ return 0;
+ }
+ }
return cmSystemTools::CreateSymlink(args[2].c_str(),
args[3].c_str())? 0:1;
}