diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-08-29 16:10:19 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-07 06:37:57 (GMT) |
commit | c38e30f68c7beffdc65af0f3799ae82ce60aaf67 (patch) | |
tree | a46d4525a0685b69df5558a98020e695e5209118 /Source | |
parent | 5d3776a7ebb718ae6ed4724e0a8961cda68b6316 (diff) | |
download | CMake-c38e30f68c7beffdc65af0f3799ae82ce60aaf67.zip CMake-c38e30f68c7beffdc65af0f3799ae82ce60aaf67.tar.gz CMake-c38e30f68c7beffdc65af0f3799ae82ce60aaf67.tar.bz2 |
cmGeneratorTarget: Add methods for generate-time source addition.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 12 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 13 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 6 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 8 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 4 |
7 files changed, 35 insertions, 13 deletions
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); } } |