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