Files
CMake/Source
Brad King c1e812ad4f target_link_libraries: Improve tolerance of unquoted generator expressions
Prior to commit 1d709ea2f5 (cmGeneratorTarget: Propagate backtraces from
INTERFACE_LINK_LIBRARIES, 2021-12-15, v3.23.0-rc1~228^2), the value of
`INTERFACE_LINK_LIBRARIES` was a single string.  If an unquoted
generator expression passed to `target_link_libraries` contained `;` and
became multiple arguments, they would all accumulate as a single
`;`-separated list in the value of `INTERFACE_LINK_LIBRARIES`.  Since
that commit, each argument to `target_link_libraries` is placed in
`INTERFACE_LINK_LIBRARIES` as a separate entry, as has long been the
case for `LINK_LIBRARIES`. That behavior change broke projects that were
accidentally relying on accumulation in `INTERFACE_LINK_LIBRARIES` to
produce complete generator expressions containing `;`.

Teach `target_link_libraries` to accumulate consecutive non-keyword
arguments into a single entry before placing them in `LINK_LIBRARIES` or
`INTERFACE_LINK_LIBRARIES`.  For example, treat `a b c` as if they were
written as `"a;b;c"`.  This restores the previously accidental support
for unquoted generator expressions in `INTERFACE_LINK_LIBRARIES`, and
also enables it for `LINK_LIBRARIES`.

For now, do not drop the `target_link_libraries` documentation that
recommends quoting generator expressions.  Quoting is still important to
populate `LINK_LIBRARIES` in CMake 3.22 and below, and is also good
practice to keep generator expressions whole.

Fixes: #23203
2022-02-15 17:38:33 -05:00
..
2022-01-21 10:59:13 -05:00
2022-01-24 11:46:29 -05:00
2022-01-28 09:36:02 -05:00
2022-02-08 10:43:14 -05:00
2021-09-09 14:02:52 -04:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2019-07-21 09:25:32 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-10-27 09:24:54 -04:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00
2021-09-21 17:14:04 +02:00