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

Hendrik Sattler post at hendrik-sattler.de
Fri Oct 2 02:58:23 EDT 2009


Zitat von "Alan W. Irwin" <irwin at 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




More information about the CMake mailing list