From 45fedf0e176d354b8cb4d3eed4a1ef9bf3943094 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 4 Sep 2020 09:51:15 -0400 Subject: Makefile: Add policy CMP0113 to avoid duplication of custom commands Do not attach a custom command to a target if it is already attached to one of the target's dependencies. The command's output will be available by the time the target needs it because the dependency containing the command will have already been built. This may break existing projects that do not properly mark non-created outputs with the `SYMBOLIC` property. Previously a chain of two custom commands whose intermediate dependency is not created would put both commands in a dependent project's Makefile even if the first command is also in its dependency's Makefile. The first command would run twice but the build would work. Now the second command needs an explicit `SYMBOLIC` mark on its input to tell CMake that it is not expected to exist. To maintain compatibility with projects that left out the mark, add a policy activating the behavior. --- Source/cmLocalUnixMakefileGenerator3.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Source/cmLocalUnixMakefileGenerator3.h') diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 095836e5dd..8286d673fc 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -19,6 +19,7 @@ class cmCustomCommandGenerator; class cmGeneratorTarget; class cmGlobalGenerator; class cmMakefile; +class cmSourceFile; /** \class cmLocalUnixMakefileGenerator3 * \brief Write a LocalUnix makefiles. @@ -294,4 +295,13 @@ private: bool ColorMakefile; bool SkipPreprocessedSourceRules; bool SkipAssemblySourceRules; + + std::set& GetCommandsVisited( + cmGeneratorTarget const* target) + { + return this->CommandsVisited[target]; + }; + + std::map> + CommandsVisited; }; -- cgit v1.2.1