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 c54c869a7127352d7e2ca757c5ecd039d12ae2ab (commit) via 2921944e08dbe5ed51d3b402ab08c49966b26ed5 (commit) via faa703b091317c76afaa8432c86f7abf8a31d53f (commit) via 092c8f35b6e9c0c2c468cc449fabaa81d574ca40 (commit) via e804e2824f44d1cc86d0dca8a6aef9b179dfa6dd (commit) via 3fb8a61ed3ff288ea404bce4b0ccda047ddaa977 (commit) via 18be18f060e897bc51acd04d0e3e7c9f2c93ecfc (commit) via 2bb6c801a18a0e7672b991dbdc1efd879116747d (commit) via 5eeb043fb2b9febef44771855d14ea6acf63d5dd (commit) via 788c3cc9e8eb4777c0146d63d8d994456ac51d19 (commit) via 41eef9ccc94f1d6c4cff0c45f02ebcdbdf185725 (commit) via 156bd2c983b439478dff5fe84629b5a93e780a92 (commit) via 01e666c70e9c83ebd8c200d121b706868f69e617 (commit) via bf28b7874b999224782fac72c5a74020bd6c47d3 (commit) via 9d653f9c1cc129be4fdce7f0e93c282760c7603e (commit) from 3d6c305c4e458276e6ebadfe88a3ca2a88c7e010 (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=c54c869a7127352d7e2ca757c5ecd039d12ae2ab commit c54c869a7127352d7e2ca757c5ecd039d12ae2ab Merge: 3d6c305 2921944 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Tue Oct 6 16:03:39 2015 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Tue Oct 6 16:03:39 2015 -0400 Merge topic 'cmGeneratorTarget-sources' into next 2921944e cmTarget: Remove Compute method. faa703b0 cmGeneratorTarget: Move computed sources from cmTarget. 092c8f35 cmGeneratorTarget: Inline GetSourceFiles from cmTarget. e804e282 cmGeneratorTarget: Move AddInterfaceEntries method. 3fb8a61e cmTarget: Remove a conditional for generate-time source addition. 18be18f0 cmTarget: Split storage of sources from genexes. 2bb6c801 cmTarget: Add Compute API for sources. 5eeb043f cmTarget: Add API for generate-time source addition. 788c3cc9 cmGeneratorTarget: Add methods for generate-time source addition. 41eef9cc Access sources through cmGeneratorTarget. 156bd2c9 Xcode: Port away from unnecessary CMP0049 compatibility. 01e666c7 cmTarget: Join strings conditionally. bf28b787 cmGeneratorTarget: Rename internal member. 9d653f9c cmFLTKWrapUI: Remove CMake 2.2 compat code. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2921944e08dbe5ed51d3b402ab08c49966b26ed5 commit 2921944e08dbe5ed51d3b402ab08c49966b26ed5 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:02:19 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=faa703b091317c76afaa8432c86f7abf8a31d53f commit faa703b091317c76afaa8432c86f7abf8a31d53f 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:02:17 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=092c8f35b6e9c0c2c468cc449fabaa81d574ca40 commit 092c8f35b6e9c0c2c468cc449fabaa81d574ca40 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:02:01 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=e804e2824f44d1cc86d0dca8a6aef9b179dfa6dd commit e804e2824f44d1cc86d0dca8a6aef9b179dfa6dd 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:02:01 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=3fb8a61ed3ff288ea404bce4b0ccda047ddaa977 commit 3fb8a61ed3ff288ea404bce4b0ccda047ddaa977 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:02:00 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=18be18f060e897bc51acd04d0e3e7c9f2c93ecfc commit 18be18f060e897bc51acd04d0e3e7c9f2c93ecfc 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:02:00 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=2bb6c801a18a0e7672b991dbdc1efd879116747d commit 2bb6c801a18a0e7672b991dbdc1efd879116747d 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:02:00 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=5eeb043fb2b9febef44771855d14ea6acf63d5dd commit 5eeb043fb2b9febef44771855d14ea6acf63d5dd 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:01:59 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=788c3cc9e8eb4777c0146d63d8d994456ac51d19 commit 788c3cc9e8eb4777c0146d63d8d994456ac51d19 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:01:56 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=41eef9ccc94f1d6c4cff0c45f02ebcdbdf185725 commit 41eef9ccc94f1d6c4cff0c45f02ebcdbdf185725 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 20:20:36 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 cae5c2f..b1e05c9 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; } @@ -572,7 +572,9 @@ bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup(const cmTarget *target) std::vector<cmSourceFile *> sources; std::string config = target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); - target->GetSourceFiles(sources, config); + cmGeneratorTarget* gt = + this->GetGlobalGenerator()->GetGeneratorTarget(target); + gt->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=156bd2c983b439478dff5fe84629b5a93e780a92 commit 156bd2c983b439478dff5fe84629b5a93e780a92 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Thu Sep 24 22:03:12 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 20:16:21 2015 +0200 Xcode: Port away from unnecessary CMP0049 compatibility. The input does not need the conversion. diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 746e1a7..64fa12a 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->AddSourceCMP0049(listfile.c_str()); + allbuild->AddSource(listfile.c_str()); // Add XCODE depend helper std::string dir = mf->GetCurrentBinaryDirectory(); @@ -557,7 +557,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, listfile = lg->GetMakefile()->GetCurrentSourceDirectory(); listfile += "/"; listfile += "CMakeLists.txt"; - target.AddSourceCMP0049(listfile.c_str()); + target.AddSource(listfile.c_str()); } } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=01e666c70e9c83ebd8c200d121b706868f69e617 commit 01e666c70e9c83ebd8c200d121b706868f69e617 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 29 18:32:24 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 20:16:20 2015 +0200 cmTarget: Join strings conditionally. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index bb44956..7fd8d86 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -768,9 +768,9 @@ void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files, //---------------------------------------------------------------------------- void cmTarget::AddTracedSources(std::vector<std::string> const& srcs) { - std::string srcFiles = cmJoin(srcs, ";"); - if (!srcFiles.empty()) + if (!srcs.empty()) { + std::string srcFiles = cmJoin(srcs, ";"); this->Internal->SourceFilesMap.clear(); this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bf28b7874b999224782fac72c5a74020bd6c47d3 commit bf28b7874b999224782fac72c5a74020bd6c47d3 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 29 18:47:14 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 20:16:20 2015 +0200 cmGeneratorTarget: Rename internal member. Leave the old name available for another use. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 62598f4..4ed2939 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -406,8 +406,8 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config, std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const { - SourceEntriesType::const_iterator i = this->SourceEntries.find(sf); - if(i != this->SourceEntries.end()) + SourceEntriesType::const_iterator i = this->SourceDepends.find(sf); + if(i != this->SourceDepends.end()) { return &i->second.Depends; } @@ -1723,7 +1723,7 @@ void cmTargetTraceDependencies::Trace() // Get the next source from the queue. cmSourceFile* sf = this->SourceQueue.front(); this->SourceQueue.pop(); - this->CurrentEntry = &this->GeneratorTarget->SourceEntries[sf]; + this->CurrentEntry = &this->GeneratorTarget->SourceDepends[sf]; // Queue dependencies added explicitly by the user. if(const char* additionalDeps = sf->GetProperty("OBJECT_DEPENDS")) diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 916f281..6d5641b 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -370,7 +370,7 @@ private: friend class cmTargetTraceDependencies; struct SourceEntry { std::vector<cmSourceFile*> Depends; }; typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType; - SourceEntriesType SourceEntries; + SourceEntriesType SourceDepends; mutable std::map<cmSourceFile const*, std::string> Objects; std::set<cmSourceFile const*> ExplicitObjectName; mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9d653f9c1cc129be4fdce7f0e93c282760c7603e commit 9d653f9c1cc129be4fdce7f0e93c282760c7603e Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sat Aug 29 18:05:46 2015 +0200 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Tue Oct 6 20:16:20 2015 +0200 cmFLTKWrapUI: Remove CMake 2.2 compat code. CMake 3.0 dropped CMake <= 2.4 compatibility. diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 12adfd9..d17d664 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -129,45 +129,6 @@ void cmFLTKWrapUICommand::FinalPass() cmSystemTools::Message(msg.c_str(),"Warning"); return; } - std::vector<cmSourceFile*> srcs; - target->GetSourceFiles(srcs, ""); - bool found = false; - for (unsigned int i = 0; i < srcs.size(); ++i) - { - if (srcs[i]->GetFullPath() == - this->GeneratedSourcesClasses[0]->GetFullPath()) - { - found = true; - break; - } - } - if (!found) - { - std::string msg = - "In CMake 2.2 the FLTK_WRAP_UI command sets a variable to the list of " - "source files that should be added to your executable or library. It " - "appears that you have not added these source files to your target. " - "You should change your CMakeLists.txt file to " - "directly add the generated files to the target. " - "For example FTLK_WRAP_UI(foo src1 src2 src3) " - "will create a variable named foo_FLTK_UI_SRCS that contains the list " - "of sources to add to your target when you call ADD_LIBRARY or " - "ADD_EXECUTABLE. For now CMake will add the sources to your target " - "for you as was done in CMake 2.0 and earlier. In the future this may " - "become an error."; - msg +="The problem was found while processing the source directory: "; - msg += this->Makefile->GetCurrentSourceDirectory(); - cmSystemTools::Message(msg.c_str(),"Warning"); - // first we add the rules for all the .fl to .h and .cxx files - size_t lastHeadersClass = this->GeneratedSourcesClasses.size(); - - // Generate code for all the .fl files - for(size_t classNum = 0; classNum < lastHeadersClass; classNum++) - { - this->Makefile->GetTargets()[this->Target] - .AddSource(this->GeneratedSourcesClasses[classNum]->GetFullPath()); - } - } } ----------------------------------------------------------------------- Summary of changes: Source/cmExtraCodeBlocksGenerator.cxx | 4 +- Source/cmExtraCodeLiteGenerator.cxx | 4 +- Source/cmExtraEclipseCDT4Generator.cxx | 4 +- Source/cmExtraSublimeTextGenerator.cxx | 2 +- Source/cmFLTKWrapUICommand.cxx | 39 --- Source/cmGeneratorTarget.cxx | 331 ++++++++++++++++++++++--- Source/cmGeneratorTarget.h | 15 +- Source/cmGhsMultiTargetGenerator.cxx | 6 +- Source/cmGlobalGenerator.cxx | 4 +- Source/cmGlobalGhsMultiGenerator.cxx | 4 +- Source/cmGlobalKdevelopGenerator.cxx | 4 +- Source/cmGlobalVisualStudio8Generator.cxx | 2 +- Source/cmGlobalXCodeGenerator.cxx | 13 +- Source/cmLocalVisualStudio6Generator.cxx | 6 +- Source/cmLocalVisualStudio7Generator.cxx | 8 +- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- Source/cmNinjaUtilityTargetGenerator.cxx | 2 +- Source/cmQtAutoGeneratorInitializer.cxx | 4 +- Source/cmTarget.cxx | 375 +++-------------------------- Source/cmTarget.h | 13 +- 21 files changed, 392 insertions(+), 452 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits