diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2018-01-09 14:09:53 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2018-01-10 16:21:11 (GMT) |
commit | d6dfde3cd35b4e1747f5658b585022961aa800b3 (patch) | |
tree | 139e25187509dab98b8737c172971673340688e0 /Source | |
parent | b0716fbcc5be83ecd082e8b6d101f1137d6f16f8 (diff) | |
download | CMake-d6dfde3cd35b4e1747f5658b585022961aa800b3.zip CMake-d6dfde3cd35b4e1747f5658b585022961aa800b3.tar.gz CMake-d6dfde3cd35b4e1747f5658b585022961aa800b3.tar.bz2 |
cmSourceFile: mark known locations as such
Primarily, this includes:
- the rule files generated for custom targets;
- source files representing custom targets directly;
- outputs of custom commands;
- byproducts of custom commands; and
- dependencies of custom commands.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMakefile.cxx | 14 | ||||
-rw-r--r-- | Source/cmSourceFile.h | 1 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 6 |
3 files changed, 14 insertions, 7 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5e32e15..b42495c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -855,7 +855,7 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput( std::string outName = gg->GenerateRuleFile(outputs[0]); // Check if the rule file already exists. - file = this->GetSource(outName); + file = this->GetSource(outName, cmSourceFileLocationKind::Known); if (file && file->GetCustomCommand() && !replace) { // The rule file already exists. if (commandLines != file->GetCustomCommand()->GetCommandLines()) { @@ -868,19 +868,22 @@ cmSourceFile* cmMakefile::AddCustomCommandToOutput( // Create a cmSourceFile for the rule file. if (!file) { - file = this->CreateSource(outName, true); + file = + this->CreateSource(outName, true, cmSourceFileLocationKind::Known); } file->SetProperty("__CMAKE_RULE", "1"); } // Always create the output sources and mark them generated. for (std::string const& o : outputs) { - if (cmSourceFile* out = this->GetOrCreateSource(o, true)) { + if (cmSourceFile* out = + this->GetOrCreateSource(o, true, cmSourceFileLocationKind::Known)) { out->SetProperty("GENERATED", "1"); } } for (std::string const& o : byproducts) { - if (cmSourceFile* out = this->GetOrCreateSource(o, true)) { + if (cmSourceFile* out = + this->GetOrCreateSource(o, true, cmSourceFileLocationKind::Known)) { out->SetProperty("GENERATED", "1"); } } @@ -1092,7 +1095,8 @@ cmTarget* cmMakefile::AddUtilityCommand( // Always create the byproduct sources and mark them generated. for (std::string const& byproduct : byproducts) { - if (cmSourceFile* out = this->GetOrCreateSource(byproduct, true)) { + if (cmSourceFile* out = this->GetOrCreateSource( + byproduct, true, cmSourceFileLocationKind::Known)) { out->SetProperty("GENERATED", "1"); } } diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index ab40da3..1516d98 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -7,6 +7,7 @@ #include "cmPropertyMap.h" #include "cmSourceFileLocation.h" +#include "cmSourceFileLocationKind.h" #include <string> #include <vector> diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 55b2c51..1974be3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -607,7 +607,8 @@ public: cmSourceFile* cmTarget::AddSource(const std::string& src) { - cmSourceFileLocation sfl(this->Makefile, src); + cmSourceFileLocation sfl(this->Makefile, src, + cmSourceFileLocationKind::Known); if (std::find_if(this->Internal->SourceEntries.begin(), this->Internal->SourceEntries.end(), TargetPropertyEntryFinder(sfl)) == @@ -619,7 +620,8 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) if (cmGeneratorExpression::Find(src) != std::string::npos) { return nullptr; } - return this->Makefile->GetOrCreateSource(src); + return this->Makefile->GetOrCreateSource(src, false, + cmSourceFileLocationKind::Known); } void cmTarget::AddLinkDirectory(const std::string& d) |