diff options
author | Brad King <brad.king@kitware.com> | 2022-02-15 21:53:15 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-02-15 22:38:33 (GMT) |
commit | c1e812ad4ff3f175dfc7c0de52b56dbaff9d3d16 (patch) | |
tree | 5840bdb54a151b2135e45d8b4f441fcdc06ae90b /Tests/CompileFeatures/cxx_lambda_init_captures.cpp | |
parent | 5571a316489ff71e4139e967464a7ad97574fce2 (diff) | |
download | CMake-c1e812ad4ff3f175dfc7c0de52b56dbaff9d3d16.zip CMake-c1e812ad4ff3f175dfc7c0de52b56dbaff9d3d16.tar.gz CMake-c1e812ad4ff3f175dfc7c0de52b56dbaff9d3d16.tar.bz2 |
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
Diffstat (limited to 'Tests/CompileFeatures/cxx_lambda_init_captures.cpp')
0 files changed, 0 insertions, 0 deletions