[CMake] cmake -E create_symlink for Windows
Bill Hoffman
bill.hoffman at kitware.com
Sat Dec 12 12:02:17 EST 2009
Alan W. Irwin wrote:
> On 2009-12-12 09:44-0500 David Cole wrote:
>
>> On Fri, Dec 11, 2009 at 10:04 AM, Michael Wild <themiwi at gmail.com> wrote:
>>
>> Bummer. What where they THINKING??? (if at all...). It seems to me
>> that M$ just CAN'T get it right. No matter how many times they try,
>> how many good examples are out there, they always manage to seriously
>> screw something up... Come to think of it, they probably were thinking
>> about symlink-attacks...
>>
>>
>> Come on. Let's make a deal: you don't bash Microsoft, Apple or Google
>> here
>> on the CMake mailing list and I won't bash Unix or Linux in any forum,
>> anywhere, ever. OK? Does that sound cool?
>
> Absolutely. There used to be another poster here (before he got
> so-over-the-top that he was removed) that kept making gratuitous attacks on
> Linux and free software, and that was extremely annoying. So as a Linux
> developer I support Dave's call to be aware of other's strong feelings
> and stay on topic so we don't waste a lot of time here.
>
> Back on topic....
>
> I am one of the lead developers of the PLplot CMake-based build system.
> However, my development experience is Linux only so I must rely on my
> Windows developer colleagues to catch any Linux-only or Unix-only
> mistakes I
> put into our build system. Up to this thread, I had no idea that there
> wasn't some reliable way to create symlinks on Windows, and it's only by
> chance that I haven't used create_symlink in any part of our build other
> than the Linux-only documentation build.
>
> Before this thread, I always assumed cmake -E commands gave you an
> excellent
> way to do common tasks in a cross-platform way. I appeal to the CMake
> developers to avoid from now on implementing any more CMake -E commands
> that
> have no hope of ever fulfilling that mandate, Also, please deprecate and
> document the cmake -E commands with obvious cross-platform limitations
> because otherwise your users are going to assume (like I did) that those
> commands are the recommended way to help make their project cross-platform.
> Is create_symlink an isolated case, or are there other cmake -E commands to
> worry about?
>
> Also, is create_symlink really a lost cross-platform cause? Reading later
> in Dave's post, it appears that the symlink concept does work on some
> Windows platform (he mentioned something about "shortcuts"). If there are
> intentions to make it work on a number of Windows platforms eventually, but
> that just hasn't happened yet, then _warn_ about that issue (e.g.,
> something
> like "Unix-only for now" in the documentation). Also, if the CMake -E
> command is run on a platform that doesn't support it something better
> than a
> silent failure should be the result.
>
Some things just can not be done cross platform. For example reading/
writing the windows registry, creating an OSX application bundle, and
sym-links. Also, some computers don't even have shared libraries.
Should we disable those features from CMake? That said, the symlink
command is the only -E that does not work cross platform. The -E
create_symlink does return failure from main when called on windows.
So, if you used it in a custom command which is the idea for -E stuff,
it would fail in a noticeable way (the build would fail). If you call
it from execute_process, you should be checking the return value as well.
-Bill
More information about the CMake
mailing list