From 9a88bc8c4bfd1c5ec0a4625750b1d513d32233c2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 21 Oct 2009 13:12:21 -0400 Subject: [PATCH] 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. --- Source/cmake.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 24b6443d4..a40d89e10 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -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 } //----------------------------------------------------------------------------