... | ... | @@ -716,14 +716,23 @@ the commands to be executed. |
|
|
|
|
|
CMake has a list data type. A list is stored as a string of
|
|
|
semicolon-separated list elements. Whitespace separated arguments to a
|
|
|
SET statement are interpreted as list elements. For instance, SET(var a
|
|
|
b c d e) will give "var" a value of a;b;c;d;e and this list can be used
|
|
|
by other CMake commands. However, if you pass ${var} to a non-CMake
|
|
|
external tool, such as a compiler's command line, you are passing
|
|
|
a;b;c;d;e which is not what you want. Instead you either need to pass
|
|
|
"${var}", so that the list will be converted to a whitespace-separated
|
|
|
string, or you need to SET(var "a b c d e") in the 1st place so that
|
|
|
you're working with a string, not a list.
|
|
|
SET statement are interpreted as list elements. For instance,
|
|
|
|
|
|
```cmake
|
|
|
set(var a b c d e)
|
|
|
```
|
|
|
|
|
|
will give `var` a value of `a;b;c;d;e` and this list can be used
|
|
|
when invoking other CMake commands. However, if you then pass `${var}` directly
|
|
|
in a context that is expecting a command-line string fragment:
|
|
|
|
|
|
```cmake
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${var}")
|
|
|
```
|
|
|
|
|
|
you are passing `a;b;c;d;e` which is not what you want.
|
|
|
|
|
|
See the [cmake-language(7)](https://cmake.org/cmake/help/latest/manual/cmake-language.7.html) manual for details on `;`-separated lists and how they are evaluated in unquoted and quoted strings.
|
|
|
|
|
|
### How can I get quoting and escapes to work properly?
|
|
|
|
... | ... | |