[CMake] Re: cmake -E create_symlink for Windows

Philippe Poilbarbe Philippe.Poilbarbe at cls.fr
Fri Aug 4 03:19:31 EDT 2006


Brandon J. Van Every a écrit :
> Brandon J. Van Every wrote:
>> The Cygwin cmake has "cmake -E create_symlink".   The Windows native 
>> cmake does not.  All the Cygwin implementation actually does is 
>> create shortcuts, and Cygwin appears to understand these as 
>> symlinks.  Are the notions of "shortcut" and "symlink" sufficiently 
>> similar, that it's reasonable to include this capability for Windows 
>> in general?  Or is Cygwin simply brighter than Windows is going to be 
>> about how to make use of them?
>> ...
>
> On 2nd thought, I've been reading up on symlinks vs. shortcuts and 
> they aren't exactly comparable.  MSYS has "ln -s" available but all it 
> does is a straight copy, not a symlink or a shortcut.  Meanwhile, 
> plain MinGW wouldn't be expected to have "ln" available, that's an 
> MSYS thing.  So in sum, I'm thinking it would be useful to have a 
> create_shortcut ability for Windows native CMake.  Does that 
> capability exist in some other form already?  If not, I'll make a 
> feature request.
> ...
Windows does not have symlinks at all. What is called shortcuts
are some files that the explorer (and some programs specially
writen to, like cygwin) interprets as some kind of symbolink
link. It is not integrated to the file system so it is not transparent
and they are not identical: a link/shortcut to a file which have
an extension (.jpg, .lib, .dll) has it's own special extension .lnk
(breaking associations) and if you open it you don't open the target.

 From the very beginning, NTFS has (hard) links ('ln' vs 'ln -s')
and so, it is limited to the same filesystem (a.k.a. partition or
volume). With them you can't differentiate the two files. But
even on the same partition it is not like symbolic links:
If you create X and link Y to X, deleting and recreating X
makes a new file different from Y (which is still the original file).
This is a different behaviour from having Y as a symbolic link
(and may break some mechanisms).

Philippe Poilbarbe


More information about the CMake mailing list