Re: [CMake] Why are blank-delimited strings in commands escaped on Linux?

2009-10-02 Thread Hendrik Sattler

Zitat von Alan W. Irwin ir...@beluga.phys.uvic.ca:


On 2009-10-01 19:51-0400 Bill Lorensen wrote:


I think if you specify each arg as a string it should work as expected.
-L/usr/lib -lcairo


To generalize that idea, I have discovered since my post that if I
transform the blank delimited string CAIRO_LINK_FLAGS (which happens to be
filled with -L/usr/lib -lcairo in this case)

to a list, e.g.,

string(REGEX REPLACE   ; CAIRO_LINK_FLAGS_LIST ${CAIRO_LINK_FLAGS})

then

COMMAND ocamlmklib options ${CAIRO_LINK_FLAGS_LIST} more options

transforms to the make VERBOSE=1 command

ocamlmklib options -L/usr/lib -lcairo more options


Doing this REGEX REPLACE cannot be the recommended way as that breaks  
any paths that contain spaces. Doesn't

  set(CAIRO_LINK_FLAGS_LIST ${CAIRO_LINK_FLAGS})
also make this a list but honors a possible quoting and escaping?  
(Note: no extra quoting in the above line).


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] Why are blank-delimited strings in commands escaped on Linux?

2009-10-02 Thread Alan W. Irwin

On 2009-10-02 08:58+0200 Hendrik Sattler wrote:


Zitat von Alan W. Irwin ir...@beluga.phys.uvic.ca:

[Use]
string(REGEX REPLACE   ; CAIRO_LINK_FLAGS_LIST ${CAIRO_LINK_FLAGS})
[to convert a blank-delimited string to a list].


Doing this REGEX REPLACE cannot be the recommended way as that breaks any 
paths that contain spaces. Doesn't

set(CAIRO_LINK_FLAGS_LIST ${CAIRO_LINK_FLAGS})
also make this a list but honors a possible quoting and escaping? (Note: no 
extra quoting in the above line).


Hi Hendrik:

I can never figure out such things 100 per cent from documentation.  Instead
I try a simple test such as

set(a hello world\\ hello world)
message(STATUS a = ${a})
set(a_list ${a})
message(STATUS a_list = ${a_list})

The result is

-- a = hello world\ hello world
-- a_list = hello world\ hello world

IOW, your idea (which I actually thought might work) does not appear to
convert a blank-delimited string to a list.

Your concern about breaking blank-containing paths is valid in general, but
in this specific case we are almost certainly okay since the result is the
link flags for libcairo as delivered by pkg-config.  I have no idea what
pkg-config would do if the path name of libcairo (which I agree in theory
could be anything since people build and install their own versions to any
location they like) contained spaces.  But assuming pkg-config worked in
this case, would it deliver -L/path/with /blanks -lcairo or -L/path/with\
/blanks -lcairo to the CMake variable? I think you would have to do
something really special in CMake to deal with this case.  I frankly don't
think the effort would be worth it, and it would just be easier to tell
users of the PLplot build system on Linux not to use a cairo installation
prefix with a blank in the name (if anyone actually ever tried that which I
doubt they would).

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] Why are blank-delimited strings in commands escaped on Linux?

2009-10-02 Thread Alan W. Irwin

On 2009-10-02 06:26+0200 Andreas Pakulat wrote:


On 01.10.09 18:18:24, Alan W. Irwin wrote:

This solution obviously reduces the urgency of the concern I expressed about
the motivation for escaping blanks for Linux because workarounds like above
can always be used.  However, I am still curious about what the motivation
is for escaping blanks for Linux commands.


Because you have to escape spaces in arguments passed to a command.


The solution I came up with produced a VERBOSE=1 result that included

-L/usr/lib -lcairo

with no escaped blanks.  So there is obviously no necessity for escaping
blanks on the command line for this case.  So why does CMake insist on
always escaping them when you are using a blank-delimited string? Why not
take the string just as is with no escapes?



Your
misinterpreting -Lx -ly as a space-delimited list.


No.  I specifically used the phrase blank-delimited string
because there is no such thing as a space-delimited list in CMake.
And the question posed by the subject line still remains.


So CMake just see's that you pass a
_single_ argument consisting of the string -Lx -ly and properly quotes
that string.


It is not that simple.  As far as I know, the _only_ case which has quotes
is if the string contains a blank and you specifically use quotes
(e.g., ${VARIABLE}) in the command for the no VERBATIM case or if you use
VERBATIM.

Also quoting and escaping are actually two separate issues (as you can see
for the no VERBATIM case where a unquoted variable consisting of a
blank-delimited string produces escaped blanks with no quotes, and an
unquoted variable consisting of a list produces ordinary delimiting blanks
with no quotes.)


 If that turns out to be a weak
motivation (i.e., replacing escaped blanks with ordinary delimiting blanks
causes little harm and helps a lot for most situations) perhaps it is time
to change CMake policy on this so that workarounds like above to avoid
escaped blanks on Linux will not be needed in the future.


Its not a workaround, if you want to pass a list of arguments to an
external command you have to create a CMake list. A string containing a
list of arguments won't work unless the arguments are delimited by ; which
implicitly makes the string a list.


The reason why the blank-delimited string doesn't work is the blanks are
escaped by CMake.  Otherwise, it would be fine.

As you know, I did try converting my blank-delimited string to a list, and
that actually worked with no VERBATIM to produce a VERBOSE=1 command that
included

-L/usr/lib -lcairo

with no quotes which is exactly what I wanted.  If that were surrounded by
quotes (as I think you get with the VERBATIM case), that should not work
since those are two command-line options (which happen to be stored
in a blank-delimited string) and not one.

However, the question posed by my subject line still remains. There is
probably a good reason why blank-delimited strings have their blanks escaped
on the Linux command line, but I would like to know what it is because I
haven't seen such a good reason yet.

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] Why are blank-delimited strings in commands escaped on Linux?

2009-10-02 Thread Claudio Bley

Hi. 

Alan W. Irwin
ir...@beluga.phys.uvic.ca writes:

 On 2009-10-02 08:58+0200 Hendrik Sattler wrote:

 Zitat von Alan W. Irwin ir...@beluga.phys.uvic.ca:
 [Use]
 string(REGEX REPLACE   ; CAIRO_LINK_FLAGS_LIST ${CAIRO_LINK_FLAGS})
 [to convert a blank-delimited string to a list].

 Doing this REGEX REPLACE cannot be the recommended way as that
 breaks any paths that contain spaces. Doesn't
 set(CAIRO_LINK_FLAGS_LIST ${CAIRO_LINK_FLAGS})
 also make this a list but honors a possible quoting and escaping?
 (Note: no extra quoting in the above line).

 Hi Hendrik:

 I can never figure out such things 100 per cent from documentation.  Instead
 I try a simple test such as

 set(a hello world\\ hello world)
 message(STATUS a = ${a})
 set(a_list ${a})
 message(STATUS a_list = ${a_list})

 The result is

 -- a = hello world\ hello world
 -- a_list = hello world\ hello world

So, the real issue here is that your CAIRO_LINK_FLAGS variable just
contains a single string, where it should contain a list instead.

You should fix that in your OCaml /PLplot module.

Regards,
Claudio

___
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] Why are blank-delimited strings in commands escaped on Linux?

2009-10-02 Thread Hendrik Sattler

Zitat von Claudio Bley b_l_...@ml1.net:

set(a hello world\\ hello world)
message(STATUS a = ${a})
set(a_list ${a})
message(STATUS a_list = ${a_list})

The result is

-- a = hello world\ hello world
-- a_list = hello world\ hello world


So, the real issue here is that your CAIRO_LINK_FLAGS variable just
contains a single string, where it should contain a list instead.

You should fix that in your OCaml /PLplot module.


He gets that from external tools. They ususally do not provide cmake lists.
But I think that his example is wrong, it should be:
set(a -Lfoo -lbar)
message(STATUS a = ${a})
set(a_list ${a})
message(STATUS a_list = ${a_list})

Then the result should be
 -- a = -Lfoo -lbar
 -- a_list = -Lfoo;-lbar

But beware that cmake lists are not the answer to everything as you  
cannot nest them. This is a problem with custom java command on  
non-Windows systems (where the argument to -cp option is also  
seperated by ';'). Maybe, no surely, that's a bug (there is absolutely  
no quoting for such list members possible, not foo;bar and not  
foo\;bar).


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] Why are blank-delimited strings in commands escaped on Linux?

2009-10-02 Thread Claudio Bley
Hendrik Sattler p...@hendrik-sattler.de
writes:

 Zitat von Claudio Bley b_l_...@ml1.net:
 set(a hello world\\ hello world)
 message(STATUS a = ${a})
 set(a_list ${a})
 message(STATUS a_list = ${a_list})

 The result is

 -- a = hello world\ hello world
 -- a_list = hello world\ hello world

 So, the real issue here is that your CAIRO_LINK_FLAGS variable just
 contains a single string, where it should contain a list instead.

 You should fix that in your OCaml /PLplot module.

 He gets that from external tools. They ususally do not provide cmake
 lists.

Ok. Then, he should use separate_arguments:

,
| separate_arguments(CAIRO_LINK_FLAGS)
`

 But I think that his example is wrong, it should be:
 set(a -Lfoo -lbar)
 message(STATUS a = ${a})
 set(a_list ${a})
 message(STATUS a_list = ${a_list})

 Then the result should be
  -- a = -Lfoo -lbar
  -- a_list = -Lfoo;-lbar

No, should it not. How should that be possible? ${a} is not a list, it's
a string (ie. it does not contain semi colons).

The output is:

,
| -- a = -Lfoo -lbar
| -- a_list = -Lfoo -lbar
`

Regards,
Claudio

___
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] Why are blank-delimited strings in commands escaped on Linux?

2009-10-02 Thread Hendrik Sattler

Zitat von Claudio Bley b_l_...@ml1.net:

But I think that his example is wrong, it should be:
set(a -Lfoo -lbar)
message(STATUS a = ${a})
set(a_list ${a})
message(STATUS a_list = ${a_list})

Then the result should be
 -- a = -Lfoo -lbar
 -- a_list = -Lfoo;-lbar


No, should it not. How should that be possible? ${a} is not a list, it's
a string (ie. it does not contain semi colons).

The output is:

,
| -- a = -Lfoo -lbar
| -- a_list = -Lfoo -lbar
`


Then explain the detailed difference between the following three:
  set(a_list -Lfoo -lbar) - creates a list with -Lfoo and -lbar
  set(a_list ${a}) - ???
  set(a_list ${a}) - ???

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] Why are blank-delimited strings in commands escaped on Linux?

2009-10-02 Thread Claudio Bley
Hendrik Sattler p...@hendrik-sattler.de
writes:

 Zitat von Claudio Bley b_l_...@ml1.net:
 But I think that his example is wrong, it should be:
 set(a -Lfoo -lbar)
 message(STATUS a = ${a})
 set(a_list ${a})
 message(STATUS a_list = ${a_list})

 Then the result should be
  -- a = -Lfoo -lbar
  -- a_list = -Lfoo;-lbar

 No, should it not. How should that be possible? ${a} is not a list, it's
 a string (ie. it does not contain semi colons).

 The output is:

 ,
 | -- a = -Lfoo -lbar
 | -- a_list = -Lfoo -lbar
 `

 Then explain the detailed difference between the following three:
   set(a_list -Lfoo -lbar) - creates a list with -Lfoo and -lbar

Correct, you could've used

,
| set(a_list -Lfoo;-lbar)
`

which is the same.

   set(a_list ${a}) - ???

This looks like a single argument to the set macro. But, ${a} is
exploded (I don't know how to better call it) - ie. if ${a} (ie. the
value of the variable a) is a list with a length greater than 1, the
macro is given several arguments, instead of one or none.

   set(a_list ${a}) - ???

Double quoting prevents exploding the value of ${a} into multiple
arguments - hence, the macro is given a single argument: a string.

To illustrate:

,[ test.cmake ]
| function(first arg)
|   message(${arg})
| endfunction(first)
| 
| set(a_list a b c)
| 
| first(${a_list})
| first(${a_list})
`

,[ cmake -P test.cmake ]
| a
| a;b;c
`

At the end, set(var z) will never set var to a list, if z itself
is no list - no matter whether z was quoted or not.

Regards,
Claudio

___
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] Why are blank-delimited strings in commands escaped on Linux?

2009-10-02 Thread Alan W. Irwin

On 2009-10-02 14:45+0200 Hendrik Sattler wrote:


Zitat von Claudio Bley b_l_...@ml1.net:

But I think that his example is wrong, it should be:
set(a -Lfoo -lbar)
message(STATUS a = ${a})
set(a_list ${a})
message(STATUS a_list = ${a_list})

Then the result should be
-- a = -Lfoo -lbar
-- a_list = -Lfoo;-lbar


No, should it not. How should that be possible? ${a} is not a list, it's
a string (ie. it does not contain semi colons).

The output is:

,
| -- a = -Lfoo -lbar
| -- a_list = -Lfoo -lbar
`


Then explain the detailed difference between the following three:
set(a_list -Lfoo -lbar) - creates a list with -Lfoo and -lbar
set(a_list ${a}) - ???
set(a_list ${a}) - ???


Hi Hendrik:

Just in case you haven't done this for yourself yet, here are the results from

set(a -Lfoo -lbar)
message(STATUS a = ${a})
set(a_list ${a})
message(STATUS a_list = ${a_list})
set(a_quoted_list ${a})
message(STATUS a_quoted_list = ${a_quoted_list})
set(a_real_list -Lfoo -lbar)
message(STATUS a_real_list = ${a_real_list})

-- a = -Lfoo -lbar
-- a_list = -Lfoo -lbar
-- a_quoted_list = -Lfoo -lbar
-- a_real_list = -Lfoo;-lbar

So it makes absolutely no difference _in this context_ whether you quote ${a}
or not.  The fourth example is just for completeness.  I hope most here know
already from similar experiments that real CMake lists are equivalent to
semicolon-delimited strings.

As for your request to explain why the second and third results are
identical, I leave that to those who understand how and why CMake has been
implemented in the way it has. I am not in that group, which is why I always
fall back to simple experiments like above to determine CMake behaviour.

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] Why are blank-delimited strings in commands escaped on Linux?

2009-10-02 Thread Bill Hoffman

Alan W. Irwin wrote:
\

As for your request to explain why the second and third results are
identical, I leave that to those who understand how and why CMake has been
implemented in the way it has. I am not in that group, which is why I 
always

fall back to simple experiments like above to determine CMake behaviour.

Alan


These pages might be of help:

http://www.cmake.org/cmake/help/syntax.html
http://www.cmake.org/Wiki/CMake/Language_Syntax

-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


[CMake] Why are blank-delimited strings in commands escaped on Linux?

2009-10-01 Thread Alan W. Irwin

First, to give some background for the question in the subject line, we have
implemented OCaml language support for PLplot using custom commands. One
issue with that support however, is that if a CMake variable is a
blank-delimited string and used as part of a custom COMMAND, then in the
command itself (as revealed by make VERBOSE=1) the blanks are escaped with
a backslash on Linux platforms.

To take one example, the ocamlmklib command needs arguments in the -L -l
form.  So we have a variable called CAIRO_LINK_FLAGS that is filled with the
blank-delimited string

-L/usr/lib -lcairo

Then in the COMMAND itself ocamlmklib options ${CAIRO_LINK_FLAGS} is
changed (as shown by make VERBOSE=1) to

ocamlmklib options -L/usr/lib\ -lcairo

if VERBATIM is not used or

ocamlmklib options -L/usr/lib\ -lcairo

when VERBATIM is used.

Both forms work on my platform (Debian stable, bash shell, ocaml version
3.10.2-3), but the first form (without any quoting) definitely causes
trouble on another PLplot developer's Linux platform. (I am still discovering
the specs for that platform, and I don't yet know where the double-quoted
version will work on that platform or not).

I am not exactly sure why either form worked at all on my platform. For the
first case, my bash shell interprets unquoted escape-blank as a literal
blank, and in the second case my shell interprets double-quoted escape-blank
as a literal backslash followed by a literal blank.  I guess on my platform,
ocamlmklib somehow translates either of those two combinations to a
delimiting blank.  But on the other developer's platform, ocamlmklib
produces errors for the first form and may well produce errors for the
second form as well.

Of course, for highest reliability what is really needed is the

ocamlmklib options -L/usr/lib -lcairo

form of command. Is there any easy way to get that form of command with
quotes and escaped blanks dropped?

This whole experience brings up the question of why the blank should be
escaped at all for general Linux commands (ocamlmklib in this case) where
CMake has no special knowledge of how to interpret the command.

I assume there must be some motivation for why CMake escapes blanks for
Linux commands. One I can think of is if someone were to use blanks in file
names on Linux, then you would need those blanks to be escaped.  My guess
though is that is a really rare occurrence; blanks in file names _always_
cause trouble on Linux so developers quickly learn to avoid them on that
platform.  For example, I am not aware of any Linux library name that has
blanks in it.  On the other hand, blank-delimited options are quite common
in Linux.  Thus, the present policy of escaping blanks in commands appears
to cause problems for the majority Linux (and probably Unix) case just to
fix an extremely rare problem.

It's quite possible I am missing a much better motivation for escaping
blanks for Linux commands, but in case it is just the above motivation, I
would argue that blank escaping of commands should be dropped for the Linux
platform and probably all Unix platforms.

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] Why are blank-delimited strings in commands escaped on Linux?

2009-10-01 Thread Bill Lorensen
I think if you specify each arg as a string it should work as expected.
 -L/usr/lib -lcairo

On Thu, Oct 1, 2009 at 6:47 PM, Alan W. Irwin ir...@beluga.phys.uvic.ca wrote:
 First, to give some background for the question in the subject line, we have
 implemented OCaml language support for PLplot using custom commands. One
 issue with that support however, is that if a CMake variable is a
 blank-delimited string and used as part of a custom COMMAND, then in the
 command itself (as revealed by make VERBOSE=1) the blanks are escaped with
 a backslash on Linux platforms.

 To take one example, the ocamlmklib command needs arguments in the -L -l
 form.  So we have a variable called CAIRO_LINK_FLAGS that is filled with the
 blank-delimited string

 -L/usr/lib -lcairo

 Then in the COMMAND itself ocamlmklib options ${CAIRO_LINK_FLAGS} is
 changed (as shown by make VERBOSE=1) to

 ocamlmklib options -L/usr/lib\ -lcairo

 if VERBATIM is not used or

 ocamlmklib options -L/usr/lib\ -lcairo

 when VERBATIM is used.

 Both forms work on my platform (Debian stable, bash shell, ocaml version
 3.10.2-3), but the first form (without any quoting) definitely causes
 trouble on another PLplot developer's Linux platform. (I am still
 discovering
 the specs for that platform, and I don't yet know where the double-quoted
 version will work on that platform or not).

 I am not exactly sure why either form worked at all on my platform. For the
 first case, my bash shell interprets unquoted escape-blank as a literal
 blank, and in the second case my shell interprets double-quoted escape-blank
 as a literal backslash followed by a literal blank.  I guess on my platform,
 ocamlmklib somehow translates either of those two combinations to a
 delimiting blank.  But on the other developer's platform, ocamlmklib
 produces errors for the first form and may well produce errors for the
 second form as well.

 Of course, for highest reliability what is really needed is the

 ocamlmklib options -L/usr/lib -lcairo

 form of command. Is there any easy way to get that form of command with
 quotes and escaped blanks dropped?

 This whole experience brings up the question of why the blank should be
 escaped at all for general Linux commands (ocamlmklib in this case) where
 CMake has no special knowledge of how to interpret the command.

 I assume there must be some motivation for why CMake escapes blanks for
 Linux commands. One I can think of is if someone were to use blanks in file
 names on Linux, then you would need those blanks to be escaped.  My guess
 though is that is a really rare occurrence; blanks in file names _always_
 cause trouble on Linux so developers quickly learn to avoid them on that
 platform.  For example, I am not aware of any Linux library name that has
 blanks in it.  On the other hand, blank-delimited options are quite common
 in Linux.  Thus, the present policy of escaping blanks in commands appears
 to cause problems for the majority Linux (and probably Unix) case just to
 fix an extremely rare problem.

 It's quite possible I am missing a much better motivation for escaping
 blanks for Linux commands, but in case it is just the above motivation, I
 would argue that blank escaping of commands should be dropped for the Linux
 platform and probably all Unix platforms.

 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

___
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] Why are blank-delimited strings in commands escaped on Linux?

2009-10-01 Thread Andreas Pakulat
On 01.10.09 18:18:24, Alan W. Irwin wrote:
 This solution obviously reduces the urgency of the concern I expressed about
 the motivation for escaping blanks for Linux because workarounds like above
 can always be used.  However, I am still curious about what the motivation
 is for escaping blanks for Linux commands.

Because you have to escape spaces in arguments passed to a command. Your
misinterpreting -Lx -ly as a space-delimited list. Its not, in CMake a
list is (AFAIK) always delimited via ;. So CMake just see's that you pass a
_single_ argument consisting of the string -Lx -ly and properly quotes
that string.

  If that turns out to be a weak
 motivation (i.e., replacing escaped blanks with ordinary delimiting blanks
 causes little harm and helps a lot for most situations) perhaps it is time
 to change CMake policy on this so that workarounds like above to avoid
 escaped blanks on Linux will not be needed in the future.

Its not a workaround, if you want to pass a list of arguments to an
external command you have to create a CMake list. A string containing a
list of arguments won't work unless the arguments are delimited by ; which
implicitly makes the string a list.

Oh and btw, spaces, umlauts and other non-ascii characters never cause any
trouble on linux (much less than on windows in fact) if you properly quote
them - which is quite easy on linux.

Andreas

-- 
You're not my type.  For that matter, you're not even my species!!!
___
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