cmTarget: Use string API to add sources to cmTarget objects.

Continue to call GetOrCreateSource where necessary to create
cmSourceFile objects which have the GENERATED attribute set.
This commit is contained in:
Stephen Kelly 2014-03-12 12:45:14 +01:00
parent d38423ecc4
commit 26d494ba01
8 changed files with 21 additions and 23 deletions

View File

@ -168,7 +168,7 @@ void cmFLTKWrapUICommand::FinalPass()
for(size_t classNum = 0; classNum < lastHeadersClass; classNum++)
{
this->Makefile->GetTargets()[this->Target]
.AddSourceFile(this->GeneratedSourcesClasses[classNum]);
.AddSource(this->GeneratedSourcesClasses[classNum]->GetFullPath());
}
}
}

View File

@ -16,6 +16,7 @@
#include "cmVisualStudioWCEPlatformParser.h"
#include "cmake.h"
#include "cmGeneratedFileStream.h"
#include "cmSourceFile.h"
static const char vs8generatorName[] = "Visual Studio 8 2005";
@ -323,7 +324,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
no_main_dependency, commandLines, "Checking Build System",
no_working_directory, true))
{
tgt->AddSourceFile(file);
tgt->AddSource(file->GetFullPath());
}
else
{

View File

@ -1260,7 +1260,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
if(cmSourceFile* sf = mf->GetOrCreateSource(fname.c_str()))
{
sf->SetProperty("LANGUAGE", llang.c_str());
cmtarget.AddSourceFile(sf);
cmtarget.AddSource(fname);
}
}
@ -2934,8 +2934,8 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
if(cmtarget.GetPropertyAsBool("MACOSX_BUNDLE"))
{
std::string plist = this->ComputeInfoPListLocation(cmtarget);
cmSourceFile* sf = mf->GetOrCreateSource(plist.c_str(), true);
cmtarget.AddSourceFile(sf);
mf->GetOrCreateSource(plist, true);
cmtarget.AddSource(plist);
}
std::vector<cmSourceFile*> classes;

View File

@ -754,8 +754,8 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
comment.c_str(),
this->Makefile->GetStartOutputDirectory()
);
target.Target->AddSourceFile
(this->Makefile->GetSource(targetFullPath));
this->Makefile->GetSource(targetFullPath);
target.Target->AddSource(targetFullPath);
}

View File

@ -253,9 +253,9 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
makefileIn.c_str(), commandLines,
comment.c_str(),
no_working_directory, true);
if(cmSourceFile* file = this->Makefile->GetSource(makefileIn.c_str()))
if(this->Makefile->GetSource(makefileIn.c_str()))
{
tgt.AddSourceFile(file);
tgt.AddSource(makefileIn);
}
else
{
@ -591,7 +591,7 @@ cmLocalVisualStudio6Generator
origCommand.GetCommandLines(), comment,
origCommand.GetWorkingDirectory().c_str()))
{
target.AddSourceFile(outsf);
target.AddSource(outsf->GetFullPath());
}
// Replace the dependencies with the output of this rule so that the

View File

@ -117,7 +117,7 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules()
{
if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
{
l->second.AddSourceFile(sf);
l->second.AddSource(sf->GetFullPath());
}
}
}
@ -153,7 +153,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
force.c_str(), no_depends, no_main_dependency,
force_commands, " ", 0, true))
{
tgt.AddSourceFile(file);
tgt.AddSource(file->GetFullPath());
}
}
}

View File

@ -1182,7 +1182,7 @@ cmMakefile::AddCustomCommandOldStyle(const std::string& target,
{
if (this->Targets.find(target) != this->Targets.end())
{
this->Targets[target].AddSourceFile(sf);
this->Targets[target].AddSource(sf->GetFullPath());
}
else
{

View File

@ -187,13 +187,11 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
mocCppFile += "/";
mocCppFile += automocTargetName;
mocCppFile += ".cpp";
cmSourceFile* mocCppSource = makefile->GetOrCreateSource(
mocCppFile,
true);
makefile->GetOrCreateSource(mocCppFile, true);
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
mocCppFile.c_str(), false);
target->AddSourceFile(mocCppSource);
target->AddSource(mocCppFile);
}
// create a custom target for running generators at buildtime:
std::string autogenTargetName = getAutogenTargetName(target);
@ -479,7 +477,7 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target)
const char *skipMocSep = "";
const char *skipUicSep = "";
std::vector<cmSourceFile*> newRccFiles;
std::vector<std::string> newRccFiles;
for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
fileIt != srcFiles.end();
@ -512,9 +510,8 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target)
rcc_output_file += "/qrc_" + basename + ".cpp";
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
rcc_output_file.c_str(), false);
cmSourceFile* rccCppSource
= makefile->GetOrCreateSource(rcc_output_file, true);
newRccFiles.push_back(rccCppSource);
makefile->GetOrCreateSource(rcc_output_file, true);
newRccFiles.push_back(rcc_output_file);
}
}
@ -546,11 +543,11 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target)
}
}
for(std::vector<cmSourceFile*>::const_iterator fileIt = newRccFiles.begin();
for(std::vector<std::string>::const_iterator fileIt = newRccFiles.begin();
fileIt != newRccFiles.end();
++fileIt)
{
const_cast<cmTarget*>(target)->AddSourceFile(*fileIt);
const_cast<cmTarget*>(target)->AddSource(*fileIt);
}
}