This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via 449739634258340947548467f73cc8c3479c2e90 (commit) via 947611f7d1d00bd7a3004104ea5a84e5bdd3d16d (commit) via 2f34cdd3793bfc53947f2bd6f5032523196c2943 (commit) via b8d23e48a296e308a31717ab213b9661adf133e1 (commit) via ff83742a8e8cf9443b08406a696aad8c70db8430 (commit) via c1bf5253ab99e76c5ba8e67ebab1256ed97142a0 (commit) via c4589e5dff619a2f0ff7c102fd8f9c012f2b01fd (commit) via e6de22ed27da0eb141f099b15fc7eab3cf738731 (commit) via dc581a1e0cc0186fcdc0d9ccc3f09c814eca700f (commit) via f1011833f215daee03dc861ed50eb0d75500c4b2 (commit) via 97d89bdfb52435323eb8922dda92cd9198397df0 (commit) via a9008a9b2c302d9a0b7deecb35e8a3d6291f0830 (commit) from 884ba71d96fe4b62336f61c367f8cf785e3842df (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=449739634258340947548467f73cc8c3479c2e90 commit 449739634258340947548467f73cc8c3479c2e90 Merge: 884ba71 947611f Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 6 16:38:38 2015 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Tue Oct 6 16:38:38 2015 -0400 Merge topic 'cmGeneratorTarget-sources' into next 947611f7 cmTarget: Remove Compute method. 2f34cdd3 cmGeneratorTarget: Move computed sources from cmTarget. b8d23e48 cmGeneratorTarget: Inline GetSourceFiles from cmTarget. ff83742a cmGeneratorTarget: Move AddInterfaceEntries method. c1bf5253 cmTarget: Remove a conditional for generate-time source addition. c4589e5d cmTarget: Split storage of sources from genexes. e6de22ed cmTarget: Add Compute API for sources. dc581a1e cmTarget: Add API for generate-time source addition. f1011833 cmGeneratorTarget: Add methods for generate-time source addition. 97d89bdf Access sources through cmGeneratorTarget. a9008a9b GHS: Port API to cmGeneratorTarget. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=947611f7d1d00bd7a3004104ea5a84e5bdd3d16d commit 947611f7d1d00bd7a3004104ea5a84e5bdd3d16d Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Sep 12 21:54:02 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 22:36:02 2015 +0200 cmTarget: Remove Compute method. The following tests FAILED: 146 - Qt5Autogen (Failed) 148 - Qt4Autogen (Failed) 298 - RunCMake.set_property (Failed) 314 - RunCMake.File_Generate (Failed) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a62d534..db842b0 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1538,7 +1538,6 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes, ti != targets.end(); ++ti) { cmTarget* t = &ti->second; - t->Compute(); cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg); this->GeneratorTargets[t] = gt; generatorTargets[t] = gt; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 5bace47..ab9d7e7 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -254,7 +254,6 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, no_working_directory, no_depends, noCommandLines); - tgt->Compute(); cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg); mf->AddGeneratorTarget(tgt, gt); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index fd2d33a..d45aa27 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -86,7 +86,6 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() no_depends, no_commands, false, "Build all projects"); - allBuild->Compute(); cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]); allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 14bc340..3d52e3a 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -456,7 +456,6 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, no_working_directory, "echo", "Build all projects"); - allbuild->Compute(); cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root); mf->AddGeneratorTarget(allbuild, allBuildGt); @@ -492,7 +491,6 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, no_working_directory, "make", "-f", file.c_str()); - check->Compute(); cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root); mf->AddGeneratorTarget(check, checkGt); } diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 1b1b98e..378f132 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -885,8 +885,6 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( /*byproducts=*/rcc_output, depends, commandLines, false, autogenComment.c_str()); - autogenTarget->Compute(); - cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg); makefile->AddGeneratorTarget(autogenTarget, gt); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e87aa16..abfc40b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -361,10 +361,6 @@ void cmTarget::SetMakefile(cmMakefile* mf) } } -void cmTarget::Compute() -{ -} - //---------------------------------------------------------------------------- void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 71f0d1f..354eda2 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -133,8 +133,6 @@ public: void AddPostBuildCommand(cmCustomCommand const &cmd) {this->PostBuildCommands.push_back(cmd);} - void Compute(); - /** * Add sources to the target. */ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2f34cdd3793bfc53947f2bd6f5032523196c2943 commit 2f34cdd3793bfc53947f2bd6f5032523196c2943 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sun Sep 13 10:18:15 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 22:36:02 2015 +0200 cmGeneratorTarget: Move computed sources from cmTarget. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 43ce882..3d5e89d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -269,7 +269,9 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) DebugIncludesDone(false), DebugCompileOptionsDone(false), DebugCompileFeaturesDone(false), - DebugCompileDefinitionsDone(false) + DebugCompileDefinitionsDone(false), + DebugSourcesDone(false), + LinkImplementationLanguageIsContextDependent(true) { this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = lg; @@ -296,6 +298,11 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) t->GetCompileDefinitionsEntries(), t->GetCompileDefinitionsBacktraces(), this->CompileDefinitionsEntries); + + CreatePropertyGeneratorExpressions( + t->GetSourceEntries(), + t->GetSourceBacktraces(), + this->SourceEntries, true); } cmGeneratorTarget::~cmGeneratorTarget() @@ -304,6 +311,7 @@ cmGeneratorTarget::~cmGeneratorTarget() cmDeleteAll(this->CompileOptionsEntries); cmDeleteAll(this->CompileFeaturesEntries); cmDeleteAll(this->CompileDefinitionsEntries); + cmDeleteAll(this->SourceEntries); cmDeleteAll(this->LinkInformation); this->LinkInformation.clear(); } @@ -404,12 +412,30 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config, void cmGeneratorTarget::AddSource(const std::string& src) { - this->Target->AddGenerateTimeSource(src); + this->Target->AddSource(src); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); + cge->SetEvaluateForBuildsystem(true); + this->SourceEntries.push_back( + new TargetPropertyEntry(cge)); } void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs) { this->Target->AddTracedSources(srcs); + if (!srcs.empty()) + { + std::string srcFiles = cmJoin(srcs, ";"); + this->SourceFilesMap.clear(); + this->LinkImplementationLanguageIsContextDependent = true; + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); + cge->SetEvaluateForBuildsystem(true); + this->SourceEntries.push_back( + new cmGeneratorTarget::TargetPropertyEntry(cge)); + } } //---------------------------------------------------------------------------- @@ -839,29 +865,216 @@ static void AddInterfaceEntries( } //---------------------------------------------------------------------------- +static bool processSources(cmGeneratorTarget const* tgt, + const std::vector<cmGeneratorTarget::TargetPropertyEntry*> &entries, + std::vector<std::string> &srcs, + UNORDERED_SET<std::string> &uniqueSrcs, + cmGeneratorExpressionDAGChecker *dagChecker, + std::string const& config, bool debugSources) +{ + cmMakefile *mf = tgt->Target->GetMakefile(); + + bool contextDependent = false; + + for (std::vector<cmGeneratorTarget::TargetPropertyEntry*>::const_iterator + it = entries.begin(), end = entries.end(); it != end; ++it) + { + cmLinkImplItem const& item = (*it)->LinkImplItem; + std::string const& targetName = item; + std::vector<std::string> entrySources; + cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, + config, + false, + tgt->Target, + tgt->Target, + dagChecker), + entrySources); + + if ((*it)->ge->GetHadContextSensitiveCondition()) + { + contextDependent = true; + } + + for(std::vector<std::string>::iterator i = entrySources.begin(); + i != entrySources.end(); ++i) + { + std::string& src = *i; + cmSourceFile* sf = mf->GetOrCreateSource(src); + std::string e; + std::string fullPath = sf->GetFullPath(&e); + if(fullPath.empty()) + { + if(!e.empty()) + { + cmake* cm = mf->GetCMakeInstance(); + cm->IssueMessage(cmake::FATAL_ERROR, e, + tgt->Target->GetBacktrace()); + } + return contextDependent; + } + + if (!targetName.empty() && !cmSystemTools::FileIsFullPath(src.c_str())) + { + std::ostringstream err; + if (!targetName.empty()) + { + err << "Target \"" << targetName << "\" contains relative " + "path in its INTERFACE_SOURCES:\n" + " \"" << src << "\""; + } + else + { + err << "Found relative path while evaluating sources of " + "\"" << tgt->GetName() << "\":\n \"" << src << "\"\n"; + } + tgt->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, err.str()); + return contextDependent; + } + src = fullPath; + } + std::string usedSources; + for(std::vector<std::string>::iterator + li = entrySources.begin(); li != entrySources.end(); ++li) + { + std::string src = *li; + + if(uniqueSrcs.insert(src).second) + { + srcs.push_back(src); + if (debugSources) + { + usedSources += " * " + src + "\n"; + } + } + } + if (!usedSources.empty()) + { + mf->GetCMakeInstance()->IssueMessage(cmake::LOG, + std::string("Used sources for target ") + + tgt->GetName() + ":\n" + + usedSources, (*it)->ge->GetBacktrace()); + } + } + return contextDependent; +} + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GetSourceFiles(std::vector<std::string> &files, + const std::string& config) const +{ + assert(this->GetType() != cmTarget::INTERFACE_LIBRARY); + + if (!this->Makefile->GetGlobalGenerator()->GetConfigureDoneCMP0026()) + { + // At configure-time, this method can be called as part of getting the + // LOCATION property or to export() a file to be include()d. However + // there is no cmGeneratorTarget at configure-time, so search the SOURCES + // for TARGET_OBJECTS instead for backwards compatibility with OLD + // behavior of CMP0024 and CMP0026 only. + + cmStringRange sourceEntries = this->Target->GetSourceEntries(); + for(cmStringRange::const_iterator + i = sourceEntries.begin(); + i != sourceEntries.end(); ++i) + { + std::string const& entry = *i; + + std::vector<std::string> items; + cmSystemTools::ExpandListArgument(entry, items); + for (std::vector<std::string>::const_iterator + li = items.begin(); li != items.end(); ++li) + { + if(cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") && + (*li)[li->size() - 1] == '>') + { + continue; + } + files.push_back(*li); + } + } + return; + } + + std::vector<std::string> debugProperties; + const char *debugProp = + this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); + if (debugProp) + { + cmSystemTools::ExpandListArgument(debugProp, debugProperties); + } + + bool debugSources = !this->DebugSourcesDone + && std::find(debugProperties.begin(), + debugProperties.end(), + "SOURCES") + != debugProperties.end(); + + if (this->Makefile->GetGlobalGenerator()->GetConfigureDoneCMP0026()) + { + this->DebugSourcesDone = true; + } + + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), + "SOURCES", 0, 0); + + UNORDERED_SET<std::string> uniqueSrcs; + bool contextDependentDirectSources = processSources(this, + this->SourceEntries, + files, + uniqueSrcs, + &dagChecker, + config, + debugSources); + + std::vector<cmGeneratorTarget::TargetPropertyEntry*> + linkInterfaceSourcesEntries; + + AddInterfaceEntries( + this, config, "INTERFACE_SOURCES", + linkInterfaceSourcesEntries); + + std::vector<std::string>::size_type numFilesBefore = files.size(); + bool contextDependentInterfaceSources = processSources(this, + linkInterfaceSourcesEntries, + files, + uniqueSrcs, + &dagChecker, + config, + debugSources); + + if (!contextDependentDirectSources + && !(contextDependentInterfaceSources && numFilesBefore < files.size())) + { + this->LinkImplementationLanguageIsContextDependent = false; + } + + cmDeleteAll(linkInterfaceSourcesEntries); +} + +//---------------------------------------------------------------------------- void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files, const std::string& config) const { + // Lookup any existing link implementation for this configuration. std::string key = cmSystemTools::UpperCase(config); - cmTarget::SourceFilesMapType& sfm = this->Target->GetSourceFilesMap(); - if(!this->Target->GetLinkImplementationLanguageIsContextDependent()) + if(!this->LinkImplementationLanguageIsContextDependent) { - files = sfm.begin()->second; + files = this->SourceFilesMap.begin()->second; return; } - cmTarget::SourceFilesMapType::iterator - it = sfm.find(key); - if(it != sfm.end()) + SourceFilesMapType::iterator + it = this->SourceFilesMap.find(key); + if(it != this->SourceFilesMap.end()) { files = it->second; } else { std::vector<std::string> srcs; - this->Target->GetSourceFiles(srcs, config); + this->GetSourceFiles(srcs, config); std::set<cmSourceFile*> emitted; @@ -874,7 +1087,7 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files, files.push_back(sf); } } - sfm[key] = files; + this->SourceFilesMap[key] = files; } } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 0c6ad82..e8c5e04 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -441,10 +441,15 @@ private: GetImportLinkInterface(const std::string& config, cmTarget const* head, bool usage_requirements_only) const; + typedef std::map<std::string, std::vector<cmSourceFile*> > + SourceFilesMapType; + mutable SourceFilesMapType SourceFilesMap; + std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries; std::vector<TargetPropertyEntry*> CompileOptionsEntries; std::vector<TargetPropertyEntry*> CompileFeaturesEntries; std::vector<TargetPropertyEntry*> CompileDefinitionsEntries; + std::vector<TargetPropertyEntry*> SourceEntries; void ExpandLinkItems(std::string const& prop, std::string const& value, std::string const& config, cmTarget const* headTarget, @@ -454,6 +459,9 @@ private: void LookupLinkItems(std::vector<std::string> const& names, std::vector<cmLinkItem>& items) const; + void GetSourceFiles(std::vector<std::string>& files, + const std::string& config) const; + typedef std::pair<std::string, bool> OutputNameKey; typedef std::map<OutputNameKey, std::string> OutputNameMapType; mutable OutputNameMapType OutputNameMap; @@ -462,6 +470,8 @@ private: mutable bool DebugCompileOptionsDone; mutable bool DebugCompileFeaturesDone; mutable bool DebugCompileDefinitionsDone; + mutable bool DebugSourcesDone; + mutable bool LinkImplementationLanguageIsContextDependent; public: std::vector<cmTarget const*> const& diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8ff729f..e87aa16 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -101,21 +101,9 @@ public: HeadToLinkImplementationMap> LinkImplMapType; LinkImplMapType LinkImplMap; - cmTarget::SourceFilesMapType SourceFilesMap; - std::set<cmLinkItem> UtilityItems; bool UtilityItemsDone; - class TargetPropertyEntry { - static cmLinkImplItem NoLinkImplItem; - public: - TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge, - cmLinkImplItem const& item = NoLinkImplItem) - : ge(cge), LinkImplItem(item) - {} - const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge; - cmLinkImplItem const& LinkImplItem; - }; std::vector<std::string> IncludeDirectoriesEntries; std::vector<cmListFileBacktrace> IncludeDirectoriesBacktraces; std::vector<std::string> CompileOptionsEntries; @@ -126,16 +114,9 @@ public: std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces; std::vector<std::string> SourceEntries; std::vector<cmListFileBacktrace> SourceBacktraces; - std::vector<TargetPropertyEntry*> SourceItems; std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries; - - void AddInterfaceEntries( - cmTarget const* thisTarget, std::string const& config, - std::string const& prop, std::vector<TargetPropertyEntry*>& entries); }; -cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem; - //---------------------------------------------------------------------------- cmTargetInternals::~cmTargetInternals() { @@ -154,8 +135,6 @@ cmTarget::cmTarget() this->IsApple = false; this->IsImportedTarget = false; this->BuildInterfaceIncludesAppended = false; - this->DebugSourcesDone = false; - this->LinkImplementationLanguageIsContextDependent = true; } void cmTarget::SetType(TargetType type, const std::string& name) @@ -382,34 +361,8 @@ void cmTarget::SetMakefile(cmMakefile* mf) } } -void CreatePropertyGeneratorExpressions( - std::vector<std::string> const& entries, - std::vector<cmListFileBacktrace> const& backtraces, - std::vector<cmTargetInternals::TargetPropertyEntry*>& items, - bool evaluateForBuildsystem = false) -{ - std::vector<cmListFileBacktrace>::const_iterator btIt = backtraces.begin(); - for (std::vector<std::string>::const_iterator it = entries.begin(); - it != entries.end(); ++it, ++btIt) - { - cmGeneratorExpression ge(*btIt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*it); - cge->SetEvaluateForBuildsystem(evaluateForBuildsystem); - items.push_back(new cmTargetInternals::TargetPropertyEntry(cge)); - } -} - void cmTarget::Compute() { - CreatePropertyGeneratorExpressions( - this->Internal->SourceEntries, - this->Internal->SourceBacktraces, - this->Internal->SourceItems, true); -} - -cmTarget::SourceFilesMapType& cmTarget::GetSourceFilesMap() const -{ - return this->Internal->SourceFilesMap; } //---------------------------------------------------------------------------- @@ -469,9 +422,7 @@ void cmTarget::FinishConfigure() //---------------------------------------------------------------------------- void cmTarget::ClearLinkMaps() { - this->LinkImplementationLanguageIsContextDependent = true; this->Internal->LinkImplMap.clear(); - this->Internal->SourceFilesMap.clear(); } //---------------------------------------------------------------------------- @@ -553,207 +504,13 @@ bool cmTarget::IsXCTestOnApple() const } //---------------------------------------------------------------------------- -static bool processSources(cmTarget const* tgt, - const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries, - std::vector<std::string> &srcs, - UNORDERED_SET<std::string> &uniqueSrcs, - cmGeneratorExpressionDAGChecker *dagChecker, - std::string const& config, bool debugSources) -{ - cmMakefile *mf = tgt->GetMakefile(); - - bool contextDependent = false; - - for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator - it = entries.begin(), end = entries.end(); it != end; ++it) - { - cmLinkImplItem const& item = (*it)->LinkImplItem; - std::string const& targetName = item; - std::vector<std::string> entrySources; - cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, - config, - false, - tgt, - tgt, - dagChecker), - entrySources); - - if ((*it)->ge->GetHadContextSensitiveCondition()) - { - contextDependent = true; - } - - for(std::vector<std::string>::iterator i = entrySources.begin(); - i != entrySources.end(); ++i) - { - std::string& src = *i; - cmSourceFile* sf = mf->GetOrCreateSource(src); - std::string e; - std::string fullPath = sf->GetFullPath(&e); - if(fullPath.empty()) - { - if(!e.empty()) - { - cmake* cm = mf->GetCMakeInstance(); - cm->IssueMessage(cmake::FATAL_ERROR, e, - tgt->GetBacktrace()); - } - return contextDependent; - } - - if (!targetName.empty() && !cmSystemTools::FileIsFullPath(src.c_str())) - { - std::ostringstream err; - if (!targetName.empty()) - { - err << "Target \"" << targetName << "\" contains relative " - "path in its INTERFACE_SOURCES:\n" - " \"" << src << "\""; - } - else - { - err << "Found relative path while evaluating sources of " - "\"" << tgt->GetName() << "\":\n \"" << src << "\"\n"; - } - tgt->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, err.str()); - return contextDependent; - } - src = fullPath; - } - std::string usedSources; - for(std::vector<std::string>::iterator - li = entrySources.begin(); li != entrySources.end(); ++li) - { - std::string src = *li; - - if(uniqueSrcs.insert(src).second) - { - srcs.push_back(src); - if (debugSources) - { - usedSources += " * " + src + "\n"; - } - } - } - if (!usedSources.empty()) - { - mf->GetCMakeInstance()->IssueMessage(cmake::LOG, - std::string("Used sources for target ") - + tgt->GetName() + ":\n" - + usedSources, (*it)->ge->GetBacktrace()); - } - } - return contextDependent; -} - -//---------------------------------------------------------------------------- -void cmTarget::GetSourceFiles(std::vector<std::string> &files, - const std::string& config) const -{ - assert(this->GetType() != INTERFACE_LIBRARY); - - if (!this->GetMakefile()->GetGlobalGenerator()->GetConfigureDoneCMP0026()) - { - // At configure-time, this method can be called as part of getting the - // LOCATION property or to export() a file to be include()d. However - // there is no cmGeneratorTarget at configure-time, so search the SOURCES - // for TARGET_OBJECTS instead for backwards compatibility with OLD - // behavior of CMP0024 and CMP0026 only. - - for(std::vector<std::string>::const_iterator - i = this->Internal->SourceEntries.begin(); - i != this->Internal->SourceEntries.end(); ++i) - { - std::string const& entry = *i; - - std::vector<std::string> items; - cmSystemTools::ExpandListArgument(entry, items); - for (std::vector<std::string>::const_iterator - li = items.begin(); li != items.end(); ++li) - { - if(cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") && - (*li)[li->size() - 1] == '>') - { - continue; - } - files.push_back(*li); - } - } - return; - } - - std::vector<std::string> debugProperties; - const char *debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) - { - cmSystemTools::ExpandListArgument(debugProp, debugProperties); - } - - bool debugSources = !this->DebugSourcesDone - && std::find(debugProperties.begin(), - debugProperties.end(), - "SOURCES") - != debugProperties.end(); - - if (this->GetMakefile()->GetGlobalGenerator()->GetConfigureDoneCMP0026()) - { - this->DebugSourcesDone = true; - } - - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - "SOURCES", 0, 0); - - UNORDERED_SET<std::string> uniqueSrcs; - bool contextDependentDirectSources = processSources(this, - this->Internal->SourceItems, - files, - uniqueSrcs, - &dagChecker, - config, - debugSources); - - std::vector<cmTargetInternals::TargetPropertyEntry*> - linkInterfaceSourcesEntries; - - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_SOURCES", - linkInterfaceSourcesEntries); - - std::vector<std::string>::size_type numFilesBefore = files.size(); - bool contextDependentInterfaceSources = processSources(this, - linkInterfaceSourcesEntries, - files, - uniqueSrcs, - &dagChecker, - config, - debugSources); - - if (!contextDependentDirectSources - && !(contextDependentInterfaceSources && numFilesBefore < files.size())) - { - this->LinkImplementationLanguageIsContextDependent = false; - } - - cmDeleteAll(linkInterfaceSourcesEntries); -} - -//---------------------------------------------------------------------------- void cmTarget::AddTracedSources(std::vector<std::string> const& srcs) { if (!srcs.empty()) { - std::string srcFiles = cmJoin(srcs, ";"); - this->Internal->SourceFilesMap.clear(); - this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - this->Internal->SourceEntries.push_back(srcFiles); + this->Internal->SourceEntries.push_back(cmJoin(srcs, ";")); this->Internal->SourceBacktraces.push_back(lfbt); - cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); - cge->SetEvaluateForBuildsystem(true); - this->Internal->SourceItems.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); } } @@ -786,8 +543,6 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs) } if (!srcFiles.empty()) { - this->Internal->SourceFilesMap.clear(); - this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->SourceEntries.push_back(srcFiles); this->Internal->SourceBacktraces.push_back(lfbt); @@ -916,8 +671,6 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) TargetPropertyEntryFinder(sfl)) == this->Internal->SourceEntries.end()) { - this->Internal->SourceFilesMap.clear(); - this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->SourceEntries.push_back(src); this->Internal->SourceBacktraces.push_back(lfbt); @@ -929,17 +682,6 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) return this->Makefile->GetOrCreateSource(src); } -void cmTarget::AddGenerateTimeSource(const std::string& src) -{ - cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); - cge->SetEvaluateForBuildsystem(true); - this->Internal->SourceItems.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); - this->AddSource(src); -} - //---------------------------------------------------------------------------- void cmTarget::MergeLinkLibraries( cmMakefile& mf, const std::string& selfname, @@ -1234,6 +976,16 @@ cmBacktraceRange cmTarget::GetCompileDefinitionsBacktraces() const return cmMakeRange(this->Internal->CompileDefinitionsBacktraces); } +cmStringRange cmTarget::GetSourceEntries() const +{ + return cmMakeRange(this->Internal->SourceEntries); +} + +cmBacktraceRange cmTarget::GetSourceBacktraces() const +{ + return cmMakeRange(this->Internal->SourceBacktraces); +} + #if defined(_WIN32) && !defined(__CYGWIN__) //---------------------------------------------------------------------------- void @@ -1649,7 +1401,6 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } - this->Internal->SourceFilesMap.clear(); this->Internal->SourceEntries.clear(); this->Internal->SourceBacktraces.clear(); @@ -1749,7 +1500,6 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } - this->Internal->SourceFilesMap.clear(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->SourceEntries.push_back(value); this->Internal->SourceBacktraces.push_back(lfbt); @@ -3424,32 +3174,6 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, } } -//---------------------------------------------------------------------------- -void cmTargetInternals::AddInterfaceEntries( - cmTarget const* thisTarget, std::string const& config, - std::string const& prop, std::vector<TargetPropertyEntry*>& entries) -{ - if(cmLinkImplementationLibraries const* impl = - thisTarget->GetLinkImplementationLibraries(config)) - { - for (std::vector<cmLinkImplItem>::const_iterator - it = impl->Libraries.begin(), end = impl->Libraries.end(); - it != end; ++it) - { - if(it->Target) - { - std::string genex = - "$<TARGET_PROPERTY:" + *it + "," + prop + ">"; - cmGeneratorExpression ge(it->Backtrace); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex); - cge->SetEvaluateForBuildsystem(true); - entries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge, *it)); - } - } - } -} - cmOptionalLinkImplementation& cmTarget::GetLinkImplMap(std::string const& config) const { @@ -3712,7 +3436,6 @@ cmTargetInternalPointer //---------------------------------------------------------------------------- cmTargetInternalPointer::~cmTargetInternalPointer() { - cmDeleteAll(this->Pointer->SourceItems); delete this->Pointer; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 6024c38..71f0d1f 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -135,15 +135,6 @@ public: void Compute(); - typedef std::map<std::string, std::vector<cmSourceFile*> > - SourceFilesMapType; - - SourceFilesMapType& GetSourceFilesMap() const; - - bool GetLinkImplementationLanguageIsContextDependent() const { - return this->LinkImplementationLanguageIsContextDependent; - } - /** * Add sources to the target. */ @@ -151,7 +142,6 @@ public: void AddTracedSources(std::vector<std::string> const& srcs); cmSourceFile* AddSourceCMP0049(const std::string& src); cmSourceFile* AddSource(const std::string& src); - void AddGenerateTimeSource(const std::string& src); enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED}; @@ -395,6 +385,9 @@ public: cmStringRange GetCompileDefinitionsEntries() const; cmBacktraceRange GetCompileDefinitionsBacktraces() const; + cmStringRange GetSourceEntries() const; + cmBacktraceRange GetSourceBacktraces() const; + #if defined(_WIN32) && !defined(__CYGWIN__) const LinkLibraryVectorType &GetLinkLibrariesForVS6() const { return this->LinkLibrariesForVS6;} @@ -473,9 +466,6 @@ private: std::string ImportedGetFullPath(const std::string& config, bool implib) const; - - void GetSourceFiles(std::vector<std::string> &files, - const std::string& config) const; private: mutable cmPropertyMap Properties; std::set<std::string> SystemIncludeDirectories; @@ -509,8 +499,6 @@ private: bool IsApple; bool IsImportedTarget; bool BuildInterfaceIncludesAppended; - mutable bool DebugSourcesDone; - mutable bool LinkImplementationLanguageIsContextDependent; #if defined(_WIN32) && !defined(__CYGWIN__) bool LinkLibrariesForVS6Analyzed; #endif https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b8d23e48a296e308a31717ab213b9661adf133e1 commit b8d23e48a296e308a31717ab213b9661adf133e1 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sun Sep 13 09:57:43 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 22:36:02 2015 +0200 cmGeneratorTarget: Inline GetSourceFiles from cmTarget. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 357b972..43ce882 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -842,7 +842,40 @@ static void AddInterfaceEntries( void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files, const std::string& config) const { - this->Target->GetSourceFiles(files, config); + // Lookup any existing link implementation for this configuration. + std::string key = cmSystemTools::UpperCase(config); + + cmTarget::SourceFilesMapType& sfm = this->Target->GetSourceFilesMap(); + if(!this->Target->GetLinkImplementationLanguageIsContextDependent()) + { + files = sfm.begin()->second; + return; + } + + cmTarget::SourceFilesMapType::iterator + it = sfm.find(key); + if(it != sfm.end()) + { + files = it->second; + } + else + { + std::vector<std::string> srcs; + this->Target->GetSourceFiles(srcs, config); + + std::set<cmSourceFile*> emitted; + + for(std::vector<std::string>::const_iterator i = srcs.begin(); + i != srcs.end(); ++i) + { + cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i); + if (emitted.insert(sf).second) + { + files.push_back(sf); + } + } + sfm[key] = files; + } } //---------------------------------------------------------------------------- diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index fc9e963..8ff729f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -101,9 +101,7 @@ public: HeadToLinkImplementationMap> LinkImplMapType; LinkImplMapType LinkImplMap; - typedef std::map<std::string, std::vector<cmSourceFile*> > - SourceFilesMapType; - SourceFilesMapType SourceFilesMap; + cmTarget::SourceFilesMapType SourceFilesMap; std::set<cmLinkItem> UtilityItems; bool UtilityItemsDone; @@ -409,6 +407,11 @@ void cmTarget::Compute() this->Internal->SourceItems, true); } +cmTarget::SourceFilesMapType& cmTarget::GetSourceFilesMap() const +{ + return this->Internal->SourceFilesMap; +} + //---------------------------------------------------------------------------- void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile) { @@ -736,46 +739,6 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, } //---------------------------------------------------------------------------- -void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files, - const std::string& config) const -{ - - // Lookup any existing link implementation for this configuration. - std::string key = cmSystemTools::UpperCase(config); - - if(!this->LinkImplementationLanguageIsContextDependent) - { - files = this->Internal->SourceFilesMap.begin()->second; - return; - } - - cmTargetInternals::SourceFilesMapType::iterator - it = this->Internal->SourceFilesMap.find(key); - if(it != this->Internal->SourceFilesMap.end()) - { - files = it->second; - } - else - { - std::vector<std::string> srcs; - this->GetSourceFiles(srcs, config); - - std::set<cmSourceFile*> emitted; - - for(std::vector<std::string>::const_iterator i = srcs.begin(); - i != srcs.end(); ++i) - { - cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i); - if (emitted.insert(sf).second) - { - files.push_back(sf); - } - } - this->Internal->SourceFilesMap[key] = files; - } -} - -//---------------------------------------------------------------------------- void cmTarget::AddTracedSources(std::vector<std::string> const& srcs) { if (!srcs.empty()) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 2f1671d..6024c38 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -135,11 +135,15 @@ public: void Compute(); - /** - * Get the list of the source files used by this target - */ - void GetSourceFiles(std::vector<cmSourceFile*> &files, - const std::string& config) const; + typedef std::map<std::string, std::vector<cmSourceFile*> > + SourceFilesMapType; + + SourceFilesMapType& GetSourceFilesMap() const; + + bool GetLinkImplementationLanguageIsContextDependent() const { + return this->LinkImplementationLanguageIsContextDependent; + } + /** * Add sources to the target. */ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ff83742a8e8cf9443b08406a696aad8c70db8430 commit ff83742a8e8cf9443b08406a696aad8c70db8430 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sun Sep 13 09:45:41 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 22:36:02 2015 +0200 cmGeneratorTarget: Move AddInterfaceEntries method. It will be needed here in a follow-up commit. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 83f9cd2..357b972 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -812,6 +812,33 @@ bool cmGeneratorTarget::GetPropertyAsBool(const std::string& prop) const } //---------------------------------------------------------------------------- +static void AddInterfaceEntries( + cmGeneratorTarget const* thisTarget, std::string const& config, + std::string const& prop, + std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries) +{ + if(cmLinkImplementationLibraries const* impl = + thisTarget->Target->GetLinkImplementationLibraries(config)) + { + for (std::vector<cmLinkImplItem>::const_iterator + it = impl->Libraries.begin(), end = impl->Libraries.end(); + it != end; ++it) + { + if(it->Target) + { + std::string genex = + "$<TARGET_PROPERTY:" + *it + "," + prop + ">"; + cmGeneratorExpression ge(it->Backtrace); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex); + cge->SetEvaluateForBuildsystem(true); + entries.push_back( + new cmGeneratorTarget::TargetPropertyEntry(cge, *it)); + } + } + } +} + +//---------------------------------------------------------------------------- void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*> &files, const std::string& config) const { @@ -2177,34 +2204,6 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt, } } - -//---------------------------------------------------------------------------- -static void AddInterfaceEntries( - cmGeneratorTarget const* thisTarget, std::string const& config, - std::string const& prop, - std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries) -{ - if(cmLinkImplementationLibraries const* impl = - thisTarget->Target->GetLinkImplementationLibraries(config)) - { - for (std::vector<cmLinkImplItem>::const_iterator - it = impl->Libraries.begin(), end = impl->Libraries.end(); - it != end; ++it) - { - if(it->Target) - { - std::string genex = - "$<TARGET_PROPERTY:" + *it + "," + prop + ">"; - cmGeneratorExpression ge(it->Backtrace); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex); - cge->SetEvaluateForBuildsystem(true); - entries.push_back( - new cmGeneratorTarget::TargetPropertyEntry(cge, *it)); - } - } - } -} - //---------------------------------------------------------------------------- std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(const std::string& config, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c1bf5253ab99e76c5ba8e67ebab1256ed97142a0 commit c1bf5253ab99e76c5ba8e67ebab1256ed97142a0 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Sep 12 21:51:10 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 22:36:02 2015 +0200 cmTarget: Remove a conditional for generate-time source addition. It is not really necessary. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6e1c488..fc9e963 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -968,19 +968,12 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) void cmTarget::AddGenerateTimeSource(const std::string& src) { - cmSourceFileLocation sfl(this->Makefile, src); - if (std::find_if(this->Internal->SourceEntries.begin(), - this->Internal->SourceEntries.end(), - TargetPropertyEntryFinder(sfl)) - == this->Internal->SourceEntries.end()) - { - cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); - cge->SetEvaluateForBuildsystem(true); - this->Internal->SourceItems.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); - } + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); + cge->SetEvaluateForBuildsystem(true); + this->Internal->SourceItems.push_back( + new cmTargetInternals::TargetPropertyEntry(cge)); this->AddSource(src); } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c4589e5dff619a2f0ff7c102fd8f9c012f2b01fd commit c4589e5dff619a2f0ff7c102fd8f9c012f2b01fd Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Aug 4 21:46:15 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 22:36:01 2015 +0200 cmTarget: Split storage of sources from genexes. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 515b261..6e1c488 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -126,7 +126,9 @@ public: std::vector<cmListFileBacktrace> CompileFeaturesBacktraces; std::vector<std::string> CompileDefinitionsEntries; std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces; - std::vector<TargetPropertyEntry*> SourceEntries; + std::vector<std::string> SourceEntries; + std::vector<cmListFileBacktrace> SourceBacktraces; + std::vector<TargetPropertyEntry*> SourceItems; std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries; void AddInterfaceEntries( @@ -385,7 +387,8 @@ void cmTarget::SetMakefile(cmMakefile* mf) void CreatePropertyGeneratorExpressions( std::vector<std::string> const& entries, std::vector<cmListFileBacktrace> const& backtraces, - std::vector<cmTargetInternals::TargetPropertyEntry*>& items) + std::vector<cmTargetInternals::TargetPropertyEntry*>& items, + bool evaluateForBuildsystem = false) { std::vector<cmListFileBacktrace>::const_iterator btIt = backtraces.begin(); for (std::vector<std::string>::const_iterator it = entries.begin(); @@ -393,12 +396,17 @@ void CreatePropertyGeneratorExpressions( { cmGeneratorExpression ge(*btIt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*it); + cge->SetEvaluateForBuildsystem(evaluateForBuildsystem); items.push_back(new cmTargetInternals::TargetPropertyEntry(cge)); } } void cmTarget::Compute() { + CreatePropertyGeneratorExpressions( + this->Internal->SourceEntries, + this->Internal->SourceBacktraces, + this->Internal->SourceItems, true); } //---------------------------------------------------------------------------- @@ -649,13 +657,11 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, // for TARGET_OBJECTS instead for backwards compatibility with OLD // behavior of CMP0024 and CMP0026 only. - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for(std::vector<TargetPropertyEntry*>::const_iterator + for(std::vector<std::string>::const_iterator i = this->Internal->SourceEntries.begin(); i != this->Internal->SourceEntries.end(); ++i) { - std::string entry = (*i)->ge->GetInput(); + std::string const& entry = *i; std::vector<std::string> items; cmSystemTools::ExpandListArgument(entry, items); @@ -697,7 +703,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, UNORDERED_SET<std::string> uniqueSrcs; bool contextDependentDirectSources = processSources(this, - this->Internal->SourceEntries, + this->Internal->SourceItems, files, uniqueSrcs, &dagChecker, @@ -778,10 +784,12 @@ void cmTarget::AddTracedSources(std::vector<std::string> const& srcs) this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + this->Internal->SourceEntries.push_back(srcFiles); + this->Internal->SourceBacktraces.push_back(lfbt); cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); cge->SetEvaluateForBuildsystem(true); - this->Internal->SourceEntries.push_back( + this->Internal->SourceItems.push_back( new cmTargetInternals::TargetPropertyEntry(cge)); } } @@ -818,11 +826,8 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs) this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); - cge->SetEvaluateForBuildsystem(true); - this->Internal->SourceEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->SourceEntries.push_back(srcFiles); + this->Internal->SourceBacktraces.push_back(lfbt); } } @@ -926,10 +931,10 @@ public: } - bool operator()(cmTargetInternals::TargetPropertyEntry* entry) + bool operator()(std::string const& entry) { std::vector<std::string> files; - cmSystemTools::ExpandListArgument(entry->ge->GetInput(), files); + cmSystemTools::ExpandListArgument(entry, files); std::vector<cmSourceFileLocation> locations(files.size()); std::transform(files.begin(), files.end(), locations.begin(), CreateLocation(this->Needle.GetMakefile())); @@ -951,11 +956,8 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); - cge->SetEvaluateForBuildsystem(true); - this->Internal->SourceEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->SourceEntries.push_back(src); + this->Internal->SourceBacktraces.push_back(lfbt); } if (cmGeneratorExpression::Find(src) != std::string::npos) { @@ -966,6 +968,19 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) void cmTarget::AddGenerateTimeSource(const std::string& src) { + cmSourceFileLocation sfl(this->Makefile, src); + if (std::find_if(this->Internal->SourceEntries.begin(), + this->Internal->SourceEntries.end(), + TargetPropertyEntryFinder(sfl)) + == this->Internal->SourceEntries.end()) + { + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); + cge->SetEvaluateForBuildsystem(true); + this->Internal->SourceItems.push_back( + new cmTargetInternals::TargetPropertyEntry(cge)); + } this->AddSource(src); } @@ -1679,13 +1694,15 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) return; } this->Internal->SourceFilesMap.clear(); - cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - cmDeleteAll(this->Internal->SourceEntries); + this->Internal->SourceEntries.clear(); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); - this->Internal->SourceEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->SourceBacktraces.clear(); + if (value) + { + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + this->Internal->SourceEntries.push_back(value); + this->Internal->SourceBacktraces.push_back(lfbt); + } } else { @@ -1778,10 +1795,8 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } this->Internal->SourceFilesMap.clear(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); - this->Internal->SourceEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->SourceEntries.push_back(value); + this->Internal->SourceBacktraces.push_back(lfbt); } else { @@ -2418,13 +2433,11 @@ const char *cmTarget::GetProperty(const std::string& prop, std::ostringstream ss; const char* sep = ""; - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for(std::vector<TargetPropertyEntry*>::const_iterator + for(std::vector<std::string>::const_iterator i = this->Internal->SourceEntries.begin(); i != this->Internal->SourceEntries.end(); ++i) { - std::string entry = (*i)->ge->GetInput(); + std::string const& entry = *i; std::vector<std::string> files; cmSystemTools::ExpandListArgument(entry, files); @@ -3076,13 +3089,11 @@ cmTarget::GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const // there is no cmGeneratorTarget at configure-time, so search the SOURCES // for TARGET_OBJECTS instead for backwards compatibility with OLD // behavior of CMP0024 and CMP0026 only. - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for(std::vector<TargetPropertyEntry*>::const_iterator + for(std::vector<std::string>::const_iterator i = this->Internal->SourceEntries.begin(); i != this->Internal->SourceEntries.end(); ++i) { - std::string entry = (*i)->ge->GetInput(); + std::string const& entry = *i; std::vector<std::string> files; cmSystemTools::ExpandListArgument(entry, files); @@ -3745,7 +3756,7 @@ cmTargetInternalPointer //---------------------------------------------------------------------------- cmTargetInternalPointer::~cmTargetInternalPointer() { - cmDeleteAll(this->Pointer->SourceEntries); + cmDeleteAll(this->Pointer->SourceItems); delete this->Pointer; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e6de22ed27da0eb141f099b15fc7eab3cf738731 commit e6de22ed27da0eb141f099b15fc7eab3cf738731 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Sep 12 21:44:52 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 22:36:01 2015 +0200 cmTarget: Add Compute API for sources. This method is a refactoring artifact. It will be removed in a follow-up. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index db842b0..a62d534 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1538,6 +1538,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes, ti != targets.end(); ++ti) { cmTarget* t = &ti->second; + t->Compute(); cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg); this->GeneratorTargets[t] = gt; generatorTargets[t] = gt; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index ab9d7e7..5bace47 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -254,6 +254,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, no_working_directory, no_depends, noCommandLines); + tgt->Compute(); cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg); mf->AddGeneratorTarget(tgt, gt); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index d45aa27..fd2d33a 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -86,6 +86,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() no_depends, no_commands, false, "Build all projects"); + allBuild->Compute(); cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]); allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 3d52e3a..14bc340 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -456,6 +456,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, no_working_directory, "echo", "Build all projects"); + allbuild->Compute(); cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root); mf->AddGeneratorTarget(allbuild, allBuildGt); @@ -491,6 +492,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, no_working_directory, "make", "-f", file.c_str()); + check->Compute(); cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root); mf->AddGeneratorTarget(check, checkGt); } diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 378f132..1b1b98e 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -885,6 +885,8 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( /*byproducts=*/rcc_output, depends, commandLines, false, autogenComment.c_str()); + autogenTarget->Compute(); + cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg); makefile->AddGeneratorTarget(autogenTarget, gt); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 16378cc..515b261 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -397,6 +397,10 @@ void CreatePropertyGeneratorExpressions( } } +void cmTarget::Compute() +{ +} + //---------------------------------------------------------------------------- void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index cbf2ca9..2f1671d 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -133,6 +133,8 @@ public: void AddPostBuildCommand(cmCustomCommand const &cmd) {this->PostBuildCommands.push_back(cmd);} + void Compute(); + /** * Get the list of the source files used by this target */ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc581a1e0cc0186fcdc0d9ccc3f09c814eca700f commit dc581a1e0cc0186fcdc0d9ccc3f09c814eca700f Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Sep 12 21:29:33 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 22:36:01 2015 +0200 cmTarget: Add API for generate-time source addition. This method is a refactoring artifact. It will be removed in a follow-up. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index dc399d8..83f9cd2 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -404,7 +404,7 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config, void cmGeneratorTarget::AddSource(const std::string& src) { - this->Target->AddSource(src); + this->Target->AddGenerateTimeSource(src); } void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7fd8d86..16378cc 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -960,6 +960,11 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) return this->Makefile->GetOrCreateSource(src); } +void cmTarget::AddGenerateTimeSource(const std::string& src) +{ + this->AddSource(src); +} + //---------------------------------------------------------------------------- void cmTarget::MergeLinkLibraries( cmMakefile& mf, const std::string& selfname, diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 3e71dbd..cbf2ca9 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -145,6 +145,7 @@ public: void AddTracedSources(std::vector<std::string> const& srcs); cmSourceFile* AddSourceCMP0049(const std::string& src); cmSourceFile* AddSource(const std::string& src); + void AddGenerateTimeSource(const std::string& src); enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED}; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f1011833f215daee03dc861ed50eb0d75500c4b2 commit f1011833f215daee03dc861ed50eb0d75500c4b2 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 29 18:10:19 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 22:36:01 2015 +0200 cmGeneratorTarget: Add methods for generate-time source addition. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 3a865fc..dc399d8 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -402,6 +402,16 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config, return i->second; } +void cmGeneratorTarget::AddSource(const std::string& src) +{ + this->Target->AddSource(src); +} + +void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs) +{ + this->Target->AddTracedSources(srcs); +} + //---------------------------------------------------------------------------- std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const @@ -1755,7 +1765,7 @@ void cmTargetTraceDependencies::Trace() } this->CurrentEntry = 0; - this->Target->AddTracedSources(this->NewSources); + this->GeneratorTarget->AddTracedSources(this->NewSources); } //---------------------------------------------------------------------------- diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 6d5641b..0c6ad82 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -296,6 +296,9 @@ public: // Get the target base name. std::string GetOutputName(const std::string& config, bool implib) const; + void AddSource(const std::string& src); + void AddTracedSources(std::vector<std::string> const& srcs); + /** * Flags for a given source file as used in this target. Typically assigned * via SET_TARGET_PROPERTIES when the property is a list of source files. diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 86a8f87..ab9d7e7 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -336,7 +336,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() no_main_dependency, commandLines, "Checking Build System", no_working_directory, true)) { - tgt->AddSource(file->GetFullPath()); + gt->AddSource(file->GetFullPath()); } else { diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 64fa12a..3d52e3a 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -463,7 +463,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, std::string listfile = mf->GetCurrentSourceDirectory(); listfile += "/"; listfile += "CMakeLists.txt"; - allbuild->AddSource(listfile.c_str()); + allBuildGt->AddSource(listfile.c_str()); // Add XCODE depend helper std::string dir = mf->GetCurrentBinaryDirectory(); @@ -553,11 +553,13 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, allbuild->AddUtility(target.GetName()); } + cmGeneratorTarget* targetGT = this->GetGeneratorTarget(&target); + // Refer to the build configuration file for easy editing. listfile = lg->GetMakefile()->GetCurrentSourceDirectory(); listfile += "/"; listfile += "CMakeLists.txt"; - target.AddSource(listfile.c_str()); + targetGT->AddSource(listfile.c_str()); } } } @@ -1401,7 +1403,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget) if(cmSourceFile* sf = mf->GetOrCreateSource(fname.c_str())) { sf->SetProperty("LANGUAGE", llang.c_str()); - cmtarget.AddSource(fname); + gtgt->AddSource(fname); } } @@ -3069,17 +3071,18 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root, continue; } + cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget); + // add the soon to be generated Info.plist file as a source for a // MACOSX_BUNDLE file if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE")) { std::string plist = this->ComputeInfoPListLocation(cmtarget); mf->GetOrCreateSource(plist, true); - cmtarget.AddSource(plist); + gtgt->AddSource(plist); } std::vector<cmSourceFile*> classes; - cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget); if (!gtgt->GetConfigCommonSourceFiles(classes)) { return false; diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index cc94cd4..ab215d1 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -243,7 +243,8 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) no_working_directory, true); if(this->Makefile->GetSource(makefileIn.c_str())) { - tgt.AddSource(makefileIn); + cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&tgt); + gt->AddSource(makefileIn); } else { @@ -595,7 +596,8 @@ cmLocalVisualStudio6Generator origCommand.GetCommandLines(), comment, origCommand.GetWorkingDirectory().c_str())) { - target.AddSource(outsf->GetFullPath()); + cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target); + gt->AddSource(outsf->GetFullPath()); } // Replace the dependencies with the output of this rule so that the diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index a4bce8a..8924564 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -112,7 +112,9 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules() } if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { - l->second.AddSource(sf->GetFullPath()); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&l->second); + gt->AddSource(sf->GetFullPath()); } } } @@ -148,7 +150,9 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() force.c_str(), no_depends, no_main_dependency, force_commands, " ", 0, true)) { - tgt.AddSource(file->GetFullPath()); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&tgt); + gt->AddSource(file->GetFullPath()); } } } diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 2703f4c..378f132 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -101,7 +101,7 @@ static void SetupSourceFiles(cmGeneratorTarget const* target, fileIt != newRccFiles.end(); ++fileIt) { - const_cast<cmTarget*>(target->Target)->AddSource(*fileIt); + const_cast<cmGeneratorTarget*>(target)->AddSource(*fileIt); } } @@ -709,7 +709,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources( makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", mocCppFile.c_str(), false); - target->Target->AddSource(mocCppFile); + target->AddSource(mocCppFile); } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=97d89bdfb52435323eb8922dda92cd9198397df0 commit 97d89bdfb52435323eb8922dda92cd9198397df0 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 29 17:51:15 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 22:36:00 2015 +0200 Access sources through cmGeneratorTarget. diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index dfd51c7..7915a6e 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -401,7 +401,9 @@ void cmExtraCodeBlocksGenerator case cmTarget::UTILITY: // can have sources since 2.6.3 { std::vector<cmSourceFile*> sources; - ti->second.GetSourceFiles(sources, + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&ti->second); + gt->GetSourceFiles(sources, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (std::vector<cmSourceFile*>::const_iterator si=sources.begin(); si!=sources.end(); si++) diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index c2cff14..496c1a8 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -196,7 +196,9 @@ void cmExtraCodeLiteGenerator case cmTarget::MODULE_LIBRARY: { std::vector<cmSourceFile*> sources; - ti->second.GetSourceFiles(sources, + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&ti->second); + gt->GetSourceFiles(sources, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (std::vector<cmSourceFile*>::const_iterator si=sources.begin(); si!=sources.end(); si++) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 44bf586..6dc18c2 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -562,7 +562,9 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets( // get the files from the source lists then add them to the groups cmTarget* tgt = const_cast<cmTarget*>(&ti->second); std::vector<cmSourceFile*> files; - tgt->GetSourceFiles(files, + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(tgt); + gt->GetSourceFiles(files, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin(); sfIt != files.end(); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 163a75b..11410a7 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -237,7 +237,7 @@ void cmExtraSublimeTextGenerator:: cmGeneratorTarget *gtgt = this->GlobalGenerator ->GetGeneratorTarget(target); std::vector<cmSourceFile*> sourceFiles; - target->GetSourceFiles(sourceFiles, + gtgt->GetSourceFiles(sourceFiles, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); std::vector<cmSourceFile*>::const_iterator sourceFilesEnd = sourceFiles.end(); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4ed2939..3a865fc 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -449,7 +449,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt, #define IMPLEMENT_VISIT_IMPL(DATA, DATATYPE) \ { \ std::vector<cmSourceFile*> sourceFiles; \ - this->Target->GetSourceFiles(sourceFiles, config); \ + this->GetSourceFiles(sourceFiles, config); \ TagVisitor<DATA ## Tag DATATYPE> visitor(this, data); \ for(std::vector<cmSourceFile*>::const_iterator si = sourceFiles.begin(); \ si != sourceFiles.end(); ++si) \ @@ -1683,7 +1683,7 @@ cmTargetTraceDependencies ci != configs.end(); ++ci) { std::vector<cmSourceFile*> sources; - this->Target->GetSourceFiles(sources, *ci); + this->GeneratorTarget->GetSourceFiles(sources, *ci); for(std::vector<cmSourceFile*>::const_iterator si = sources.begin(); si != sources.end(); ++si) { @@ -4444,12 +4444,12 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles( std::vector<std::string>::const_iterator it = configs.begin(); const std::string& firstConfig = *it; - this->Target->GetSourceFiles(files, firstConfig); + this->GetSourceFiles(files, firstConfig); for ( ; it != configs.end(); ++it) { std::vector<cmSourceFile*> configFiles; - this->Target->GetSourceFiles(configFiles, *it); + this->GetSourceFiles(configFiles, *it); if (configFiles != files) { std::string firstConfigFiles; diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 46ea2f3..bfcef43 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -172,7 +172,7 @@ std::vector<cmSourceFile *> cmGhsMultiTargetGenerator::GetSources() const { std::vector<cmSourceFile *> output; std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->Target->GetSourceFiles(output, config); + this->GeneratorTarget->GetSourceFiles(output, config); return output; } @@ -574,7 +574,7 @@ bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup( std::vector<cmSourceFile *> sources; std::string config = target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); - target->Target->GetSourceFiles(sources, config); + target->GetSourceFiles(sources, config); for (std::vector<cmSourceFile *>::const_iterator sources_i = sources.begin(); sources.end() != sources_i; ++sources_i) { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 05f1029..db842b0 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2949,10 +2949,12 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target) { configs.push_back(""); } + cmGeneratorTarget* gt = + this->GetGeneratorTarget(target); for(std::vector<std::string>::const_iterator ci = configs.begin(); ci != configs.end(); ++ci) { - target->GetSourceFiles(sources, *ci); + gt->GetSourceFiles(sources, *ci); } std::vector<cmSourceFile*>::const_iterator sourcesEnd = cmRemoveDuplicates(sources); diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 6dde1e3..e66bc2a 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -520,7 +520,9 @@ bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmTarget *tgt) const std::string config = tgt->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); std::vector<cmSourceFile *> tgtSources; - tgt->GetSourceFiles(tgtSources, config); + cmGeneratorTarget* gt = + this->GetGlobalGenerator()->GetGeneratorTarget(tgt); + gt->GetSourceFiles(tgtSources, config); bool tgtInBuild = true; char const *excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL"); if (NULL != excludeFromAll && '1' == excludeFromAll[0] && diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 138ddbb..c40f846 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -139,7 +139,9 @@ bool cmGlobalKdevelopGenerator ti != targets.end(); ti++) { std::vector<cmSourceFile*> sources; - ti->second.GetSourceFiles(sources, ti->second.GetMakefile() + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&ti->second); + gt->GetSourceFiles(sources, ti->second.GetMakefile() ->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (std::vector<cmSourceFile*>::const_iterator si=sources.begin(); si!=sources.end(); si++) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index b278087..cd499f6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1149,7 +1149,7 @@ cmMakefileTargetGenerator { // Depend on all custom command outputs. std::vector<cmSourceFile*> sources; - this->Target->GetSourceFiles(sources, + this->GeneratorTarget->GetSourceFiles(sources, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for(std::vector<cmSourceFile*>::const_iterator source = sources.begin(); source != sources.end(); ++source) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 84c19a3..24fcaf4 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -112,7 +112,7 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules() // Write rules for languages compiled in this target. std::set<std::string> languages; std::vector<cmSourceFile*> sourceFiles; - this->GetTarget()->GetSourceFiles(sourceFiles, + this->GetGeneratorTarget()->GetSourceFiles(sourceFiles, this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE")); for(std::vector<cmSourceFile*>::const_iterator i = sourceFiles.begin(); i != sourceFiles.end(); ++i) diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 58b901a..df43c61 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -58,7 +58,7 @@ void cmNinjaUtilityTargetGenerator::Generate() std::vector<cmSourceFile*> sources; std::string config = this->GetMakefile() ->GetSafeDefinition("CMAKE_BUILD_TYPE"); - this->GetTarget()->GetSourceFiles(sources, config); + this->GetGeneratorTarget()->GetSourceFiles(sources, config); for(std::vector<cmSourceFile*>::const_iterator source = sources.begin(); source != sources.end(); ++source) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9008a9b2c302d9a0b7deecb35e8a3d6291f0830 commit a9008a9b2c302d9a0b7deecb35e8a3d6291f0830 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 6 22:35:28 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 22:35:28 2015 +0200 GHS: Port API to cmGeneratorTarget. diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index cae5c2f..46ea2f3 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -27,7 +27,7 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget *target) , LocalGenerator(static_cast<cmLocalGhsMultiGenerator *>( target->GetLocalGenerator())) , Makefile(target->Target->GetMakefile()) - , TargetGroup(DetermineIfTargetGroup(target->Target)) + , TargetGroup(DetermineIfTargetGroup(target)) , DynamicDownload(false) { this->RelBuildFilePath = this->GetRelBuildFilePath(target->Target); @@ -178,10 +178,11 @@ std::vector<cmSourceFile *> cmGhsMultiTargetGenerator::GetSources() const GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const { - return cmGhsMultiTargetGenerator::GetGpjTag(this->Target); + return cmGhsMultiTargetGenerator::GetGpjTag(this->GeneratorTarget); } -GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag(const cmTarget *target) +GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag( + const cmGeneratorTarget *target) { GhsMultiGpj::Types output; if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup(target)) @@ -566,13 +567,14 @@ bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const &config, return output; } -bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup(const cmTarget *target) +bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup( + const cmGeneratorTarget *target) { bool output = false; std::vector<cmSourceFile *> sources; std::string config = - target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); - target->GetSourceFiles(sources, config); + target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); + target->Target->GetSourceFiles(sources, config); for (std::vector<cmSourceFile *>::const_iterator sources_i = sources.begin(); sources.end() != sources_i; ++sources_i) { diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index c29a31e..d1c17f4 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -36,7 +36,7 @@ public: bool IncludeThisTarget(); std::vector<cmSourceFile *> GetSources() const; GhsMultiGpj::Types GetGpjTag() const; - static GhsMultiGpj::Types GetGpjTag(const cmTarget *target); + static GhsMultiGpj::Types GetGpjTag(const cmGeneratorTarget* target); const char *GetAbsBuildFilePath() const { return this->AbsBuildFilePath.c_str(); @@ -95,7 +95,7 @@ private: std::string GetOutputFilename(const std::string &config) const; bool IsNotKernel(std::string const &config, const std::string &language); - static bool DetermineIfTargetGroup(const cmTarget *target); + static bool DetermineIfTargetGroup(const cmGeneratorTarget* target); bool DetermineIfDynamicDownload(std::string const &config, const std::string &language); ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits