Re: [CMake] cmake -E create_symlink for Windows

2009-12-14 Thread Marcel Loose
On Sat, 2009-12-12 at 12:02 -0500, Bill Hoffman wrote:
 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 them...@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

Just out of curiosity: how does Cygwin handle this whole symbolic link
business? 

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


Re: [CMake] cmake -E create_symlink for Windows

2009-12-14 Thread Bill Lorensen
http://en.wikipedia.org/wiki/Symbolic_link#Cygwin_symbolic_links

On Mon, Dec 14, 2009 at 3:28 AM, Marcel Loose lo...@astron.nl wrote:
 On Sat, 2009-12-12 at 12:02 -0500, Bill Hoffman wrote:
 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 them...@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

 Just out of curiosity: how does Cygwin handle this whole symbolic link
 business?

 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

___
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


Re: [CMake] cmake -E create_symlink for Windows

2009-12-14 Thread Marcel Loose
On Mon, 2009-12-14 at 08:23 -0500, Bill Lorensen wrote:
 http://en.wikipedia.org/wiki/Symbolic_link#Cygwin_symbolic_links
 

OK, that puts us back at square one.

Why is it that CMake cannot use Windows shortcuts as an alternative to
Unix symbolic links, whereas Cygwin can?

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


Re: [CMake] cmake -E create_symlink for Windows

2009-12-14 Thread Michael Wild

On 14. Dec, 2009, at 14:29 , Marcel Loose wrote:

 On Mon, 2009-12-14 at 08:23 -0500, Bill Lorensen wrote:
 http://en.wikipedia.org/wiki/Symbolic_link#Cygwin_symbolic_links
 
 
 OK, that puts us back at square one.
 
 Why is it that CMake cannot use Windows shortcuts as an alternative to
 Unix symbolic links, whereas Cygwin can?
 
 Best regards,
 Marcel Loose.
 

Because somebody has to implement it ;-). And then I'm not sure that the 
tool-chain (i.e. compilers etc.) will be able to handle Windows-shortcuts. Does 
anybody know, or has visual studio available to try it out, whether e.g. CL.exe 
and RC.exe can handle Windows-shortcuts? What about MINGW, GnuWin32 and Intel 
compilers?

Michael
___
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


Re: [CMake] cmake -E create_symlink for Windows

2009-12-14 Thread Andreas Pakulat
On 14.12.09 14:29:06, Marcel Loose wrote:
 On Mon, 2009-12-14 at 08:23 -0500, Bill Lorensen wrote:
  http://en.wikipedia.org/wiki/Symbolic_link#Cygwin_symbolic_links
  
 
 OK, that puts us back at square one.
 
 Why is it that CMake cannot use Windows shortcuts as an alternative to
 Unix symbolic links, whereas Cygwin can?

Becaue Cygwin emulates a complete filesystem IIRC (at least inside its
bash). The problem is not that cmake could not create a shortcut for the -E
create_symlink  call, the problem is that very few apps are able to
recognize the shortcut as symlink and act accordingly. So it simply doesn't
make any sense to create one if it only works when the user double-clicks
on it in explorer.

Andreas

-- 
Keep it short for pithy sake.
___
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


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

2009-12-14 Thread 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, cmake-requ...@cmake.org wrote:
 Send CMake mailing list submissions to
   cmake@cmake.org
 
 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
   cmake-requ...@cmake.org
 
 You can reach the person managing the list at
   cmake-owne

 r...@cmake.org
 
 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 lo...@astron.nl
 Subject: Re: [CMake] cmake -E create_symlink for Windows
 To: Alan W. Irwin ir...@beluga.phys.uvic.ca
 Cc: cmake@cmake.org, Michael Wild them...@gmail.com,Bill Hoffman
   bill.hoff...@kitware.com
 Message-ID: 1260743898.18575.13.ca...@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

Re: [CMake] cmake -E create_symlink for Windows

2009-12-14 Thread Samuel E. Henley
I think it comes down to what error to flag, “You can't use this command
on your operation system because we didn't implement it” or “your
operation system is obsolete – build a work-around” or “no message at
all because it's windows and no one does development with windows”. The
last is odd for a cross-platform make/auto tools replacement, but I
favor “your system is obsolete” – I least the script writer will know at
the first test of his code, to change his code – after all CMake is only
a tool. I use the junction program with my continuous and nightly builds
– otherwise I would have multiple copy of pre-build third-party
libraries or end up requiring the libraries to always be in the same
location(Linux). My Linux builds use the links for the same reason. The
only problem is when your using the explorer – you don't know it's a
link – so I always add batch files to remove or add the links using
junction – you could change their folder icon. There is a program to
link files but I've never found a use for linking single files. But your
right it doesn't work like Linux.

Samuel E. Henley OSRail.net






___
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

Re: [CMake] cmake -E create_symlink for Windows

2009-12-13 Thread Marcel Loose
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


Re: [CMake] cmake -E create_symlink for Windows

2009-12-12 Thread David Cole
On Fri, Dec 11, 2009 at 10:04 AM, Michael Wild them...@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?

The fact is that Microsoft introduced shortcuts in Windows 95 and Apple
had aliases on Mac OS even before that... and they are both conceptually
equivalent to symlinks.

symlinks are a *convenience* feature... but they are not supported
everywhere universally. So write the code that uses them if they are there,
but has an alternate strategy if they're not available. But don't blame
Microsoft...

Maybe you should ask yourself why you're even bothering to write software
for Windows if it's so bad.


:-)
David
___
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

Re: [CMake] cmake -E create_symlink for Windows

2009-12-12 Thread Alan W. Irwin

On 2009-12-12 09:44-0500 David Cole wrote:


On Fri, Dec 11, 2009 at 10:04 AM, Michael Wild them...@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.

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
__
___
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


Re: [CMake] cmake -E create_symlink for Windows

2009-12-12 Thread Bill Hoffman

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 them...@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
___
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


Re: [CMake] cmake -E create_symlink for Windows

2009-12-12 Thread Michael Wild

On 12. Dec, 2009, at 17:42 , 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 them...@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?

I beg your pardon?! I think just a little exasperation is in place here, 
especially I couldn't find any documentation on this apart from the page 
mentioned by Hendrik. What had me really surprised is the fact that 
http://msdn.microsoft.com/en-us/library/aa363866(VS.85).aspx doesn't say a word 
on the fact that the function will fail if the executing process doesn't have 
the SeCreateSymbolic right. My wording may have been a bit crude, for this I 
apologize. And I did mention a good reason for having this stringent policy 
(i.e. symlink attacks). Besides, if you feel like expressing your displeasure 
with Linux and Unix, please go ahead. After all, if nobody ever does so, how do 
you expect things to improve in the first place?

And referring to the Windows shortcuts: No, they are not equivalent, as they 
require special treatment and parsing. They are only work-alikes from the user 
point-of-view when he's interacting with them in the Explorer, or other 
software that implements the protocol. They are NOT transparent in the sense 
that if you write a piece of software that reads and writes to files, you don't 
have to care whether this actually is a shortcut or not.

 
 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.
 

As I mentioned, I only expressed my disappointment that it won't be possible to 
implement -E create_symlink in any useful way on Windows, so yes, IMHO it was 
on topic. The waste of time comes into play if somebody spends considerable 
effort developing a build system using -E create_symlink on a non-Windows 
platform and then has to refactor the whole thing because he based the whole 
thing on wrong assumptions (refer to your post below).

[...]

 
 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?

I don't think it should be deprecated or removed, just for the simple reason 
that there is a lot of Unix-only software using CMake that can really profit 
from it. This also applies to other platform peculiarities. However, what 
definitely needs to be done, is to state the supported platforms very clearly 
in the documentation.

 
 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.

As I said, shortcuts are only poor man's substitutes for symlinks. 
Essentially, they are files with a .lnk extension that contain the shortcut 
destination. In as such they are not THAT different from most symlink 
implementations. The difference is, that they are not part of the file system 
and that the programmer needs to deal with them manually. Refer to 
http://msdn.microsoft.com/en-us/library/bb776891(VS.85).aspx to get an 
impression of how tedious that is.

Again, I'm sorry if I offended any of you, that was not my intention. But I 
also hope that you understand some of my exasperation.

Michael
___
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 

Re: [CMake] cmake -E create_symlink for Windows

2009-12-12 Thread Alan W. Irwin

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
__
___
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


[CMake] cmake -E create_symlink for Windows

2009-12-11 Thread Marcel Loose
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.


___
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


Re: [CMake] cmake -E create_symlink for Windows

2009-12-11 Thread Michael Wild

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
___
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


Re: [CMake] cmake -E create_symlink for Windows

2009-12-11 Thread Marcel Loose
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.



___
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


Re: [CMake] cmake -E create_symlink for Windows

2009-12-11 Thread Hendrik Sattler

Zitat von Michael Wild them...@gmail.com:

On 11. Dec, 2009, at 14:27 , Marcel Loose wrote:

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.


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


For this, also see
  http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html
Please note the UAC dialog when creating symlink on Vista. Have fun,  
I'd say :-(


And what do you do on WindowsXP? What to do on FAT filesystems?
Additionally, without that extension above, it is non-obvious for  
Windows users that a specific file is a symbolic link.


HS


___
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


Re: [CMake] cmake -E create_symlink for Windows

2009-12-11 Thread Hendrik Sattler

Zitat von Michael Wild them...@gmail.com:

On 11. Dec, 2009, at 15:17 , Hendrik Sattler wrote:

Zitat von Michael Wild them...@gmail.com:

On 11. Dec, 2009, at 14:27 , Marcel Loose wrote:

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.


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


For this, also see
 http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html
Please note the UAC dialog when creating symlink on Vista. Have   
fun, I'd say :-(


And what do you do on WindowsXP? What to do on FAT filesystems?
Additionally, without that extension above, it is non-obvious for   
Windows users that a specific file is a symbolic link.


The UAC-thing only applies to directories where the user has no   
write-acces (including the admin), right? So if you're half-way   
sane, and build in a user-owned directory, you should be UAC-free...


To cite from that page:
 Vista and UAC

One of the major Vista changes was the so called User Account Control  
(UAC). Due to UAC some API calls need elevation to administrative  
level, and this elevation must be acknowledged via the below shown  
dialog box. Unfortunately, and I still can't believe this, the API  
call CreateSymbolicLink is a call, which needs elevation, and thus  
causes this annoying dialog box come up every time a symbolic link is  
created.



So, no, every time, even on own directories. I don't currently use  
Vista or Windows7, though. Also read the rest of that part of the  
page: cmake should not use functions directly that need elevation.


HS

PS: added list back


___
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


Re: [CMake] cmake -E create_symlink for Windows

2009-12-11 Thread David Cole
On Fri, Dec 11, 2009 at 9:18 AM, Marcel Loose lo...@astron.nl wrote:

 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?


I can't speak for the rest of the CMake developers, but personally, I just
simply avoid symlinks at all costs in projects that are meant to be
cross-platform. If I'm working on a Mac-or-Linux-only project, symlinks can
sometimes be useful... but they are simply not useful on Windows.

Just my opinion,
David
___
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

Re: [CMake] cmake -E create_symlink for Windows

2009-12-11 Thread Michael Wild

On 11. Dec, 2009, at 15:35 , Hendrik Sattler wrote:

 Zitat von Michael Wild them...@gmail.com:
 On 11. Dec, 2009, at 15:17 , Hendrik Sattler wrote:
 Zitat von Michael Wild them...@gmail.com:
 On 11. Dec, 2009, at 14:27 , Marcel Loose wrote:
 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.
 
 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
 
 For this, also see
 http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html
 Please note the UAC dialog when creating symlink on Vista. Have  fun, I'd 
 say :-(
 
 And what do you do on WindowsXP? What to do on FAT filesystems?
 Additionally, without that extension above, it is non-obvious for  Windows 
 users that a specific file is a symbolic link.
 
 The UAC-thing only applies to directories where the user has no  write-acces 
 (including the admin), right? So if you're half-way  sane, and build in a 
 user-owned directory, you should be UAC-free...
 
 To cite from that page:
 Vista and UAC
 
 One of the major Vista changes was the so called User Account Control (UAC). 
 Due to UAC some API calls need elevation to administrative level, and this 
 elevation must be acknowledged via the below shown dialog box. Unfortunately, 
 and I still can't believe this, the API call CreateSymbolicLink is a call, 
 which needs elevation, and thus causes this annoying dialog box come up every 
 time a symbolic link is created.
 

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...

 
 So, no, every time, even on own directories. I don't currently use Vista or 
 Windows7, though. Also read the rest of that part of the page: cmake should 
 not use functions directly that need elevation.
 

Agreed, but then creating symlinks will be just plain impossible on Windows...

For the general interest: somebody did it for 4msysgit.

http://repo.or.cz/w/git/mingw/4msysgit.git/commitdiff/043a43e7ec1ca4aa492406f438d89e1f35df127a

Michael

___
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