|
|
@@ -26,10 +26,12 @@
|
|
|
#include "cmMakefileLibraryTargetGenerator.h"
|
|
|
#include "cmMakefileUtilityTargetGenerator.h"
|
|
|
#include "cmOutputConverter.h"
|
|
|
+#include "cmPolicies.h"
|
|
|
#include "cmProperty.h"
|
|
|
#include "cmRange.h"
|
|
|
#include "cmRulePlaceholderExpander.h"
|
|
|
#include "cmSourceFile.h"
|
|
|
+#include "cmSourceFileLocationKind.h"
|
|
|
#include "cmState.h"
|
|
|
#include "cmStateDirectory.h"
|
|
|
#include "cmStateSnapshot.h"
|
|
|
@@ -51,6 +53,17 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
|
|
|
if (cmProp ruleStatus = cm->GetState()->GetGlobalProperty("RULE_MESSAGES")) {
|
|
|
this->NoRuleMessages = cmIsOff(*ruleStatus);
|
|
|
}
|
|
|
+ switch (this->GeneratorTarget->GetPolicyStatusCMP0113()) {
|
|
|
+ case cmPolicies::WARN:
|
|
|
+ case cmPolicies::OLD:
|
|
|
+ this->CMP0113New = false;
|
|
|
+ break;
|
|
|
+ case cmPolicies::NEW:
|
|
|
+ case cmPolicies::REQUIRED_IF_USED:
|
|
|
+ case cmPolicies::REQUIRED_ALWAYS:
|
|
|
+ this->CMP0113New = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
MacOSXContentGenerator = cm::make_unique<MacOSXContentGeneratorType>(this);
|
|
|
}
|
|
|
|
|
|
@@ -217,6 +230,12 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
|
|
this->GeneratorTarget->GetCustomCommands(customCommands,
|
|
|
this->GetConfigName());
|
|
|
for (cmSourceFile const* sf : customCommands) {
|
|
|
+ if (this->CMP0113New &&
|
|
|
+ !this->LocalGenerator->GetCommandsVisited(this->GeneratorTarget)
|
|
|
+ .insert(sf)
|
|
|
+ .second) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
cmCustomCommandGenerator ccg(*sf->GetCustomCommand(),
|
|
|
this->GetConfigName(), this->LocalGenerator);
|
|
|
this->GenerateCustomRuleFile(ccg);
|
|
|
@@ -1290,16 +1309,7 @@ void cmMakefileTargetGenerator::DriveCustomCommands(
|
|
|
std::vector<std::string>& depends)
|
|
|
{
|
|
|
// Depend on all custom command outputs.
|
|
|
- std::vector<cmSourceFile*> sources;
|
|
|
- this->GeneratorTarget->GetSourceFiles(
|
|
|
- sources, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
|
|
|
- for (cmSourceFile* source : sources) {
|
|
|
- if (cmCustomCommand* cc = source->GetCustomCommand()) {
|
|
|
- cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
|
|
|
- this->LocalGenerator);
|
|
|
- cm::append(depends, ccg.GetOutputs());
|
|
|
- }
|
|
|
- }
|
|
|
+ cm::append(depends, this->CustomCommandOutputs);
|
|
|
}
|
|
|
|
|
|
void cmMakefileTargetGenerator::WriteObjectDependRules(
|
|
|
@@ -1346,6 +1356,22 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
|
|
|
bool symbolic = this->WriteMakeRule(*this->BuildFileStream, nullptr, outputs,
|
|
|
depends, commands);
|
|
|
|
|
|
+ // Symbolic inputs are not expected to exist, so add dummy rules.
|
|
|
+ if (this->CMP0113New && !depends.empty()) {
|
|
|
+ std::vector<std::string> no_depends;
|
|
|
+ std::vector<std::string> no_commands;
|
|
|
+ for (std::string const& dep : depends) {
|
|
|
+ if (cmSourceFile* dsf =
|
|
|
+ this->Makefile->GetSource(dep, cmSourceFileLocationKind::Known)) {
|
|
|
+ if (dsf->GetPropertyAsBool("SYMBOLIC")) {
|
|
|
+ this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, nullptr,
|
|
|
+ dep, no_depends, no_commands,
|
|
|
+ true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// If the rule has changed make sure the output is rebuilt.
|
|
|
if (!symbolic) {
|
|
|
this->GlobalGenerator->AddRuleHash(ccg.GetOutputs(), content.str());
|
|
|
@@ -1360,6 +1386,8 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
|
|
|
this->LocalGenerator->AddImplicitDepends(this->GeneratorTarget, idi.first,
|
|
|
objFullPath, srcFullPath);
|
|
|
}
|
|
|
+
|
|
|
+ this->CustomCommandOutputs.insert(outputs.begin(), outputs.end());
|
|
|
}
|
|
|
|
|
|
void cmMakefileTargetGenerator::MakeEchoProgress(
|