add_custom_command: Add DEPENDS_EXPLICIT_ONLY option for Ninja

Add option `DEPENDS_EXPLICIT_ONLY` to `add_custom_command` to indicate
that implicit dependencies coming from users of the output are not
needed, and only consider dependencies explicitly specified in the
custom command.

Fixes: #17097
This commit is contained in:
Abdelmaged Khalifa
2023-02-12 01:00:40 +02:00
committed by Brad King
parent 48c69eeafe
commit 082ccd7530
8 changed files with 104 additions and 27 deletions
+6
View File
@@ -102,6 +102,11 @@ public:
bool GetCommandExpandLists() const;
void SetCommandExpandLists(bool b);
/** Set/Get whether to use additional dependencies coming from
users of OUTPUT of the custom command. */
bool GetDependsExplicitOnly() const;
void SetDependsExplicitOnly(bool b);
/** Set/Get the depfile (used by the Ninja generator) */
const std::string& GetDepfile() const;
void SetDepfile(const std::string& depfile);
@@ -141,6 +146,7 @@ private:
bool CommandExpandLists = false;
bool StdPipesUTF8 = false;
bool HasMainDependency_ = false;
bool DependsExplicitOnly = false;
// Policies are NEW for synthesized custom commands, and set by cmMakefile for
// user-created custom commands.