add_custom_command: Target-dependent generator expression support

OUTPUT variant with a TARGET given to allow resolving target-based generator
expressions wouldn't work because OUTPUT is resolved before generator targets
are created, i.e. FindGeneratorTargetToUse() returns nullptr.
This is a known limitation, see #21364.

Implements #21336.
This commit is contained in:
Raul Tambre
2020-12-19 14:14:18 +02:00
parent 7676e11943
commit 1cb4f592a0
9 changed files with 65 additions and 7 deletions

View File

@@ -100,6 +100,10 @@ public:
cmPolicies::PolicyStatus GetCMP0116Status() const;
void SetCMP0116Status(cmPolicies::PolicyStatus cmp0116);
/** Set/Get the associated target */
const std::string& GetTarget() const;
void SetTarget(const std::string& target);
private:
std::vector<std::string> Outputs;
std::vector<std::string> Byproducts;
@@ -107,6 +111,7 @@ private:
cmCustomCommandLines CommandLines;
cmListFileBacktrace Backtrace;
cmImplicitDependsList ImplicitDepends;
std::string Target;
std::string Comment;
std::string WorkingDirectory;
std::string Depfile;