diff options
author | Brad King <brad.king@kitware.com> | 2022-03-17 13:13:40 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-03-17 13:13:47 (GMT) |
commit | e56afbca89c7acd826cddc676a68fbbe2b75398e (patch) | |
tree | dd0d68c1b7555fc0d7b65907265b4089123f5ffb /Source | |
parent | 7f36e0ff6ec624668b1353ad706c0663637cbbb7 (diff) | |
parent | add64399c54859d26f9954fb06d616dbd00bffe7 (diff) | |
download | CMake-e56afbca89c7acd826cddc676a68fbbe2b75398e.zip CMake-e56afbca89c7acd826cddc676a68fbbe2b75398e.tar.gz CMake-e56afbca89c7acd826cddc676a68fbbe2b75398e.tar.bz2 |
Merge topic 'tll-genex-concat'
add64399c5 target_link_libraries: Restore LINK_ONLY for multiple static lib dependencies
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7078
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmTargetLinkLibrariesCommand.cxx | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 0ba93fb..e1a6c78 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -9,6 +9,7 @@ #include <utility> #include <cm/optional> +#include <cm/string_view> #include "cmExecutionStatus.h" #include "cmGeneratorExpression.h" @@ -183,8 +184,11 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args, // Accumulate consectuive non-keyword arguments into one entry in // order to handle unquoted generator expressions containing ';'. + std::size_t genexNesting = 0; cm::optional<std::string> currentEntry; auto processCurrentEntry = [&]() -> bool { + // FIXME: Warn about partial genex if genexNesting > 0? + genexNesting = 0; if (currentEntry) { assert(!haveLLT); if (!tll.HandleLibrary(currentProcessingState, *currentEntry, @@ -220,7 +224,7 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args, // of debug and optimized that can be used. for (unsigned int i = 1; i < args.size(); ++i) { if (keywords.count(args[i])) { - // A keyword argument terminates any preceding accumulated entry. + // A keyword argument terminates any accumulated partial genex. if (!processCurrentEntry()) { return false; } @@ -321,12 +325,33 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args, } llt = GENERAL_LibraryType; } else { + // Track the genex nesting level. + { + cm::string_view arg = args[i]; + for (std::string::size_type pos = 0; pos < arg.size(); ++pos) { + cm::string_view cur = arg.substr(pos); + if (cmHasLiteralPrefix(cur, "$<")) { + ++genexNesting; + ++pos; + } else if (genexNesting > 0 && cmHasLiteralPrefix(cur, ">")) { + --genexNesting; + } + } + } + // Accumulate this argument in the current entry. extendCurrentEntry(args[i]); + + // Process this entry if it does not end inside a genex. + if (genexNesting == 0) { + if (!processCurrentEntry()) { + return false; + } + } } } - // Process the last accumulated entry, if any. + // Process the last accumulated partial genex, if any. if (!processCurrentEntry()) { return false; } |