diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5a478d069..8cc6f7a85 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -727,6 +727,10 @@ int cmake::CMakeCommand(std::vector& args) if(soName != realName) { std::string fname = cmSystemTools::GetFilenameName(realName); + if(cmSystemTools::FileExists(soName.c_str())) + { + cmSystemTools::RemoveFile(soName.c_str()); + } if(!cmSystemTools::CreateSymlink(fname.c_str(), soName.c_str())) { result = 1; @@ -735,6 +739,10 @@ int cmake::CMakeCommand(std::vector& args) if(name != soName) { std::string fname = cmSystemTools::GetFilenameName(soName); + if(cmSystemTools::FileExists(soName.c_str())) + { + cmSystemTools::RemoveFile(name.c_str()); + } if(!cmSystemTools::CreateSymlink(fname.c_str(), name.c_str())) { result = 1;