cmGeneratorTarget: Add methods for generate-time source addition.
This commit is contained in:
parent
5d3776a7eb
commit
c38e30f68c
|
@ -402,6 +402,16 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config,
|
||||||
return i->second;
|
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*
|
std::vector<cmSourceFile*> const*
|
||||||
cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const
|
cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const
|
||||||
|
@ -1755,7 +1765,7 @@ void cmTargetTraceDependencies::Trace()
|
||||||
}
|
}
|
||||||
this->CurrentEntry = 0;
|
this->CurrentEntry = 0;
|
||||||
|
|
||||||
this->Target->AddTracedSources(this->NewSources);
|
this->GeneratorTarget->AddTracedSources(this->NewSources);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -296,6 +296,9 @@ public:
|
||||||
// Get the target base name.
|
// Get the target base name.
|
||||||
std::string GetOutputName(const std::string& config, bool implib) const;
|
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
|
* 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.
|
* via SET_TARGET_PROPERTIES when the property is a list of source files.
|
||||||
|
|
|
@ -336,7 +336,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
|
||||||
no_main_dependency, commandLines, "Checking Build System",
|
no_main_dependency, commandLines, "Checking Build System",
|
||||||
no_working_directory, true))
|
no_working_directory, true))
|
||||||
{
|
{
|
||||||
tgt->AddSource(file->GetFullPath());
|
gt->AddSource(file->GetFullPath());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -463,7 +463,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
||||||
std::string listfile = mf->GetCurrentSourceDirectory();
|
std::string listfile = mf->GetCurrentSourceDirectory();
|
||||||
listfile += "/";
|
listfile += "/";
|
||||||
listfile += "CMakeLists.txt";
|
listfile += "CMakeLists.txt";
|
||||||
allbuild->AddSource(listfile.c_str());
|
allBuildGt->AddSource(listfile.c_str());
|
||||||
|
|
||||||
// Add XCODE depend helper
|
// Add XCODE depend helper
|
||||||
std::string dir = mf->GetCurrentBinaryDirectory();
|
std::string dir = mf->GetCurrentBinaryDirectory();
|
||||||
|
@ -553,11 +553,13 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
||||||
allbuild->AddUtility(target.GetName());
|
allbuild->AddUtility(target.GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmGeneratorTarget* targetGT = this->GetGeneratorTarget(&target);
|
||||||
|
|
||||||
// Refer to the build configuration file for easy editing.
|
// Refer to the build configuration file for easy editing.
|
||||||
listfile = lg->GetMakefile()->GetCurrentSourceDirectory();
|
listfile = lg->GetMakefile()->GetCurrentSourceDirectory();
|
||||||
listfile += "/";
|
listfile += "/";
|
||||||
listfile += "CMakeLists.txt";
|
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()))
|
if(cmSourceFile* sf = mf->GetOrCreateSource(fname.c_str()))
|
||||||
{
|
{
|
||||||
sf->SetProperty("LANGUAGE", llang.c_str());
|
sf->SetProperty("LANGUAGE", llang.c_str());
|
||||||
cmtarget.AddSource(fname);
|
gtgt->AddSource(fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3069,17 +3071,18 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
|
||||||
|
|
||||||
// add the soon to be generated Info.plist file as a source for a
|
// add the soon to be generated Info.plist file as a source for a
|
||||||
// MACOSX_BUNDLE file
|
// MACOSX_BUNDLE file
|
||||||
if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE"))
|
if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE"))
|
||||||
{
|
{
|
||||||
std::string plist = this->ComputeInfoPListLocation(cmtarget);
|
std::string plist = this->ComputeInfoPListLocation(cmtarget);
|
||||||
mf->GetOrCreateSource(plist, true);
|
mf->GetOrCreateSource(plist, true);
|
||||||
cmtarget.AddSource(plist);
|
gtgt->AddSource(plist);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<cmSourceFile*> classes;
|
std::vector<cmSourceFile*> classes;
|
||||||
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
|
|
||||||
if (!gtgt->GetConfigCommonSourceFiles(classes))
|
if (!gtgt->GetConfigCommonSourceFiles(classes))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -243,7 +243,8 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
|
||||||
no_working_directory, true);
|
no_working_directory, true);
|
||||||
if(this->Makefile->GetSource(makefileIn.c_str()))
|
if(this->Makefile->GetSource(makefileIn.c_str()))
|
||||||
{
|
{
|
||||||
tgt.AddSource(makefileIn);
|
cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&tgt);
|
||||||
|
gt->AddSource(makefileIn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -595,7 +596,8 @@ cmLocalVisualStudio6Generator
|
||||||
origCommand.GetCommandLines(), comment,
|
origCommand.GetCommandLines(), comment,
|
||||||
origCommand.GetWorkingDirectory().c_str()))
|
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
|
// Replace the dependencies with the output of this rule so that the
|
||||||
|
|
|
@ -112,7 +112,9 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules()
|
||||||
}
|
}
|
||||||
if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
|
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.c_str(), no_depends, no_main_dependency,
|
||||||
force_commands, " ", 0, true))
|
force_commands, " ", 0, true))
|
||||||
{
|
{
|
||||||
tgt.AddSource(file->GetFullPath());
|
cmGeneratorTarget* gt =
|
||||||
|
this->GlobalGenerator->GetGeneratorTarget(&tgt);
|
||||||
|
gt->AddSource(file->GetFullPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
|
||||||
fileIt != newRccFiles.end();
|
fileIt != newRccFiles.end();
|
||||||
++fileIt)
|
++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",
|
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
|
||||||
mocCppFile.c_str(), false);
|
mocCppFile.c_str(), false);
|
||||||
|
|
||||||
target->Target->AddSource(mocCppFile);
|
target->AddSource(mocCppFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue