Use copies for versioned names on Windows

Versioned UNIX libraries and executables produce multiple names for a
single target using one of

  cmake -E cmake_symlink_library
  cmake -E cmake_symlink_executable

to create symlinks to the real file for the extra names.  However, when
cross-compiling from Windows to Linux we cannot create symlinks.  This
commit teaches CMake to make copies instead of symbolic links when
running on windows.  While this approach does not produce exactly what
Linux wants to see, at least the build will complete and the binary will
run on the target system.  See issue #9171.
This commit is contained in:
Brad King 2009-10-21 13:12:21 -04:00
parent 7a6db286c8
commit 9a88bc8c4b
1 changed files with 4 additions and 0 deletions

View File

@ -3129,8 +3129,12 @@ bool cmake::SymlinkInternal(std::string const& file, std::string const& link)
{
cmSystemTools::RemoveFile(link.c_str());
}
#if defined(_WIN32) && !defined(__CYGWIN__)
return cmSystemTools::CopyFileAlways(file.c_str(), link.c_str());
#else
std::string linktext = cmSystemTools::GetFilenameName(file);
return cmSystemTools::CreateSymlink(linktext.c_str(), link.c_str());
#endif
}
//----------------------------------------------------------------------------