[CMake] cmake -E create_symlink for Windows

Marcel Loose loose at astron.nl
Fri Dec 11 09:18:42 EST 2009


On Fri, 2009-12-11 at 14:51 +0100, Michael Wild wrote:
> On 11. Dec, 2009, at 14:27 , Marcel Loose wrote:
> 
> > Hi all,
> > 
> > I was browsing the CMake sources for a problem I was facing with the
> > creation of symlinks (on Unix that is) and I noticed that the
> > SystemTools::CreateSymlink function simply returns false when building
> > on a Windows platform. 
> > 
> > Does that mean that I cannot use 'cmake -E create_symlink' on Windows.
> > If that's the case I consider it a bug, because the documentation
> > suggests that 'cmake -E create_symlink' provides a platform independent
> > way of creating symbolic links. So, if the OS and/or filesystem does not
> > support symbolic links, IMHO, it should just copy the file.
> > 
> > Best regards,
> > Marcel Loose.
> > 
> 
> Simply copying the file might be just as bad if people assume it really IS a symlink... IMHO, if the OS can't create a symlink, cmake -E create_symlink should fail loudly, not just silently ignore it. And somebody should implement this function for Windows >= Vista/2008 (i.e. WINVER >= 0x0600):
> 
> http://msdn.microsoft.com/en-us/library/aa363866(VS.85).aspx
> 
> Michael

Hi Michael,

I think it depends. Failing loudly may not always be desirable, just as
failing silently. 

In my particular case, I was just creating a bunch of symlinks to
directories; no need to discern these symlinks from the actual
directories, but I need to be able to access the directory contents.

When it comes to symlinks to files, there may be situations where you
would really like it to be a link, e.g. when editing the file. Would
that be a CMake usage scenario??

I don't know what's the best way to deal with this issue. What do the
CMake developers think of this?

Best regards,
Marcel Loose.





More information about the CMake mailing list