Installing folder that's a symlink fails
Hi.
Summary
When installing a folder on Windows via install(FOLDER ...)
an error is encountered if the source folder is a symbolic link.
Steps to reproduce
- Make a file/folder structure, where
FakeFolder
is a symlink toTrueFolder
:
TrueFolder/Test.txt
FakeFolder
- Next to these create
CMakeLists.txt
with contents:
project(Test CXX)
cmake_minimum_required(VERSION 2.8)
install(DIRECTORY "FakeFolder" DESTINATION ".")
- Try to CMake and build (with Powershell and VS2017 in my case):
mkdir build
cd .\build
cmake .. '-DCMAKE_INSTALL_PREFIX=../Deployment'
cmake --build . --target install
What is the current bug behavior?
CMake Error at cmake_install.cmake:36 (file):
file INSTALL cannot read symlink
"Blahblah/FakeFolder" to duplicate at
"Blahblah/Deployment/./FakeFolder".
INSTALL works fine if I'm installing a subfolder inside the FakeFolder
, e.g. install(DIRECTORY "FakeFolder\SubFolder" DESTINATION ".")
.
I tried to run CMake as admin to see if the problem is that it tries to make a symlink instead of copying but the result is the same.
What is the expected correct behavior?
TrueFolder
recursively copied to Deployment, but named FakeFolder
.
Platform
Windows 7, CMake 3.12.2, VS 2017 Pro.