Re: cmake -E create_symlink for Windows CMake Digest, Vol 68, Issue 51

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: cmake -E create_symlink for Windows CMake Digest, Vol 68, Issue 51

Samuel E. Henley
I think there should be a cross platform command for creating symbolic
links, under windows 2000 and above with the ntfs formatted disk. You
can create symbolic links to directories with a program called
“junction” (Vista has a build-in command) - junction has switches that
would simulate the Linux version of ln -s. Of course in Windows it's a
real link to the directory and if you delete/copy the files you get the
results you would expect – files are deleted or copied – not links. You
could get around this by getting a directory listing under windows –
which does show junctions – and use the junction program to make the
copies. Of course all the file commands in windows would have to check
for this property because CMake itself has adopted the Linux version of
a file system for its cross-platform commands.

The objection that CMake would now have to find and run an external
program – doesn't have much weight because cmake does this all the time,
It finds the compiler, linker, resource compiler etc. If that is not an
acceptable method to implement the command – then a built-in version of
junction could be created – In CTest you should take a look at the
platform-dependent code to determine if a windows machine can run
multi-CPU threads. – a built-in version of symbolic links would not
generate any more or obscure platform-dependent code then that test
whose only purpose is to fill a form for CDash. As for the problem at
hand you could create a MACRO that uses cmake -E under Linux and
junction under windows.
   Samuel E. Henley OSRail.net


On Mon, 2009-12-14 at 06:00 -0500, [hidden email] wrote:

> Send CMake mailing list submissions to
> [hidden email]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://www.cmake.org/mailman/listinfo/cmake
> or, via email, send a message with subject or body 'help' to
> [hidden email]
>
> You can reach the person managing the list at
> cmake-owne

> [hidden email]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of CMake digest..."
>
>
> Today's Topics:
>
>    1. Re: Mac OSX GUI (Bill Hoffman)
>    2. Re: cmake -E create_symlink for Windows (Marcel Loose)
>    3. Re: Mac OSX GUI (Steven Wilson)
>    4. Re: Mac OSX GUI (Mike Jackson)
>    5. Re: cmake -E create_symlink for Windows (Marcel Loose)
>    6. Re: ADD_CUSTOM_COMMAND (Keyan)
>    7. How to generate xcodeproj file correctly for Xcode? (DONG Li)
>
>
> Message: 2
> Date: Sun, 13 Dec 2009 23:38:18 +0100
> From: Marcel Loose <[hidden email]>
> Subject: Re: [CMake] cmake -E create_symlink for Windows
> To: "Alan W. Irwin" <[hidden email]>
> Cc: [hidden email], Michael Wild <[hidden email]>, Bill Hoffman
> <[hidden email]>
> Message-ID: <1260743898.18575.13.camel@galadriel>
> Content-Type: text/plain; charset="UTF-8"
>
> On Sat, 2009-12-12 at 14:35 -0800, Alan W. Irwin wrote:
> > On 2009-12-12 12:02-0500 Bill Hoffman wrote:
> >
> > > 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.
> >
> > I guess I am the victim of the assumption that all cmake -E commands are
> > supposed to work cross-platform since all of them do so (which I was glad to
> > hear) other than create_symlink.  Right now, here is what cmake -E help says
> > about that command.
> >
> >    create_symlink old new    - create a symbolic link new -> old
> >
> > If you simply added (UNIX ONLY) to that documentation string, then users
> > like me wouldn't make unwarranted assumptions.
> >
> > Alan
> > __________________________
> > Alan W. Irwin
> >
> > Astronomical research affiliation with Department of Physics and Astronomy,
> > University of Victoria (astrowww.phys.uvic.ca).
> >
> > Programming affiliations with the FreeEOS equation-of-state implementation
> > for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
> > package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
> > Linux Links project (loll.sf.net); and the Linux Brochure Project
> > (lbproject.sf.net).
> > __________________________
> >
> > Linux-powered Science
> > __________________________
>
> I second that. I was also under the impression that 'cmake -E' provided
> a nice abstraction for a number of commands that could be used
> cross-platform, but with different syntaxes. Seems that create_symlink
> is the odd one out here. Bummer!
>
> The thing is: it's too late when the build fails (on Windows), because
> long before then, I, as a developer of the build environment, decided to
> use the presumed cross-platform command create_symlink, only to find out
> much later that it doesn't work on Windows.
>
> Best regards,
> Marcel Loose.
>
>
>
>


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake