Merge topic 'use-generator-target'

6cac952b VS: Port interface to cmGeneratorTarget
97b37688 VS: Port WriteUtilityDepends to cmGeneratorTarget
600af01d VS: Port utility depends to cmGeneratorTarget
330bfa83 VS: Port target depends to cmGeneratorTarget
b13e26e2 VS: Port ProjectDepends to cmGeneratorTarget.
8ac8739b VS: Port TargetIsFortranOnly to cmGeneratorTarget
84fb579f VS: Port WriteProject to cmGeneratorTarget
1eff421a VS: Port loop to cmGeneratorTarget
94fd5a5a VS: Port ImplibDir to cmGeneratorTarget
ce9e9a92 VS: Port LinkClosure to cmGeneratorTarget
26e23e84 VS: Port ComputeLongestObjectDirectory to cmGeneratorTarget
01c26986 VS7: Port to cmGeneratorTarget
459c8910 VS10: Port to cmGeneratorTarget.
7f8bb857 VS6: Port to cmGeneratorTarget.
a0ebd69b Graphviz: Port to cmGeneratorTarget.
bcee21ce C::B: Port API to cmGeneratorTarget.
...
This commit is contained in:
Brad King 2015-10-26 13:13:04 -04:00 committed by CMake Topic Stage
commit d288b216af
69 changed files with 1197 additions and 1193 deletions

View File

@ -18,7 +18,6 @@
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmTarget.h"
cmCommonTargetGenerator::cmCommonTargetGenerator( cmCommonTargetGenerator::cmCommonTargetGenerator(
cmOutputConverter::RelativeRoot wd, cmOutputConverter::RelativeRoot wd,
@ -26,7 +25,6 @@ cmCommonTargetGenerator::cmCommonTargetGenerator(
) )
: WorkingDirectory(wd) : WorkingDirectory(wd)
, GeneratorTarget(gt) , GeneratorTarget(gt)
, Target(gt->Target)
, Makefile(gt->Makefile) , Makefile(gt->Makefile)
, LocalGenerator(static_cast<cmLocalCommonGenerator*>(gt->LocalGenerator)) , LocalGenerator(static_cast<cmLocalCommonGenerator*>(gt->LocalGenerator))
, GlobalGenerator(static_cast<cmGlobalCommonGenerator*>( , GlobalGenerator(static_cast<cmGlobalCommonGenerator*>(
@ -123,7 +121,7 @@ std::string cmCommonTargetGenerator::ComputeFortranModuleDirectory() const
else else
{ {
// Interpret relative to the current output directory. // Interpret relative to the current output directory.
mod_dir = this->Makefile->GetCurrentBinaryDirectory(); mod_dir = this->LocalGenerator->GetCurrentBinaryDirectory();
mod_dir += "/"; mod_dir += "/";
mod_dir += target_mod_dir; mod_dir += target_mod_dir;
} }

View File

@ -21,7 +21,6 @@ class cmGlobalCommonGenerator;
class cmLocalCommonGenerator; class cmLocalCommonGenerator;
class cmMakefile; class cmMakefile;
class cmSourceFile; class cmSourceFile;
class cmTarget;
/** \class cmCommonTargetGenerator /** \class cmCommonTargetGenerator
* \brief Common infrastructure for Makefile and Ninja per-target generators * \brief Common infrastructure for Makefile and Ninja per-target generators
@ -49,7 +48,6 @@ protected:
cmOutputConverter::RelativeRoot WorkingDirectory; cmOutputConverter::RelativeRoot WorkingDirectory;
cmGeneratorTarget* GeneratorTarget; cmGeneratorTarget* GeneratorTarget;
cmTarget* Target;
cmMakefile* Makefile; cmMakefile* Makefile;
cmLocalCommonGenerator* LocalGenerator; cmLocalCommonGenerator* LocalGenerator;
cmGlobalCommonGenerator* GlobalGenerator; cmGlobalCommonGenerator* GlobalGenerator;

View File

@ -175,13 +175,12 @@ void cmComputeTargetDepends::CollectTargets()
this->GlobalGenerator->GetLocalGenerators(); this->GlobalGenerator->GetLocalGenerators();
for(unsigned int i = 0; i < lgens.size(); ++i) for(unsigned int i = 0; i < lgens.size(); ++i)
{ {
const cmTargets& targets = lgens[i]->GetMakefile()->GetTargets(); const std::vector<cmGeneratorTarget*> targets =
for(cmTargets::const_iterator ti = targets.begin(); lgens[i]->GetGeneratorTargets();
for(std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin();
ti != targets.end(); ++ti) ti != targets.end(); ++ti)
{ {
cmTarget const* target = &ti->second; cmGeneratorTarget* gt = *ti;
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(target);
int index = static_cast<int>(this->Targets.size()); int index = static_cast<int>(this->Targets.size());
this->TargetIndex[gt] = index; this->TargetIndex[gt] = index;
this->Targets.push_back(gt); this->Targets.push_back(gt);

View File

@ -456,13 +456,13 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
if (cge->GetHadContextSensitiveCondition()) if (cge->GetHadContextSensitiveCondition())
{ {
cmMakefile* mf = target->Target->GetMakefile(); cmLocalGenerator* lg = target->GetLocalGenerator();
std::ostringstream e; std::ostringstream e;
e << "Target \"" << target->GetName() << "\" is installed with " e << "Target \"" << target->GetName() << "\" is installed with "
"INCLUDES DESTINATION set to a context sensitive path. Paths which " "INCLUDES DESTINATION set to a context sensitive path. Paths which "
"depend on the configuration, policy values or the link interface are " "depend on the configuration, policy values or the link interface are "
"not supported. Consider using target_include_directories instead."; "not supported. Consider using target_include_directories instead.";
mf->IssueMessage(cmake::FATAL_ERROR, e.str()); lg->IssueMessage(cmake::FATAL_ERROR, e.str());
return; return;
} }
@ -535,11 +535,11 @@ void getCompatibleInterfaceProperties(cmGeneratorTarget *target,
if (!info) if (!info)
{ {
cmMakefile* mf = target->Target->GetMakefile(); cmLocalGenerator* lg = target->GetLocalGenerator();
std::ostringstream e; std::ostringstream e;
e << "Exporting the target \"" << target->GetName() << "\" is not " e << "Exporting the target \"" << target->GetName() << "\" is not "
"allowed since its linker language cannot be determined"; "allowed since its linker language cannot be determined";
mf->IssueMessage(cmake::FATAL_ERROR, e.str()); lg->IssueMessage(cmake::FATAL_ERROR, e.str());
return; return;
} }
@ -835,13 +835,13 @@ cmExportFileGenerator
if(newCMP0022Behavior && !this->ExportOld) if(newCMP0022Behavior && !this->ExportOld)
{ {
cmMakefile *mf = target->Target->GetMakefile(); cmLocalGenerator *lg = target->GetLocalGenerator();
std::ostringstream e; std::ostringstream e;
e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, " e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, "
"but also has old-style LINK_INTERFACE_LIBRARIES properties " "but also has old-style LINK_INTERFACE_LIBRARIES properties "
"populated, but it was exported without the " "populated, but it was exported without the "
"EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties"; "EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties";
mf->IssueMessage(cmake::FATAL_ERROR, e.str()); lg->IssueMessage(cmake::FATAL_ERROR, e.str());
return; return;
} }

View File

@ -17,7 +17,6 @@
#include "cmake.h" #include "cmake.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmTarget.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmXMLSafe.h" #include "cmXMLSafe.h"
@ -319,12 +318,12 @@ void cmExtraCodeBlocksGenerator
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin(); for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
lg!=lgs.end(); lg++) lg!=lgs.end(); lg++)
{ {
cmMakefile* makefile=(*lg)->GetMakefile(); std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
cmTargets& targets=makefile->GetTargets(); for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
for (cmTargets::iterator ti = targets.begin();
ti != targets.end(); ti++) ti != targets.end(); ti++)
{ {
switch(ti->second.GetType()) std::string targetName = (*ti)->GetName();
switch((*ti)->GetType())
{ {
case cmState::GLOBAL_TARGET: case cmState::GLOBAL_TARGET:
{ {
@ -333,7 +332,7 @@ void cmExtraCodeBlocksGenerator
if (strcmp((*lg)->GetCurrentBinaryDirectory(), if (strcmp((*lg)->GetCurrentBinaryDirectory(),
(*lg)->GetBinaryDirectory())==0) (*lg)->GetBinaryDirectory())==0)
{ {
this->AppendTarget(fout, ti->first, 0, this->AppendTarget(fout, targetName, 0,
make.c_str(), *lg, compiler.c_str()); make.c_str(), *lg, compiler.c_str());
} }
} }
@ -341,15 +340,16 @@ void cmExtraCodeBlocksGenerator
case cmState::UTILITY: case cmState::UTILITY:
// Add all utility targets, except the Nightly/Continuous/ // Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart // Experimental-"sub"targets as e.g. NightlyStart
if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly")) if (((targetName.find("Nightly")==0) &&(targetName!="Nightly"))
|| ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous")) || ((targetName.find("Continuous")==0)
|| ((ti->first.find("Experimental")==0) &&(targetName!="Continuous"))
&& (ti->first!="Experimental"))) || ((targetName.find("Experimental")==0)
&& (targetName!="Experimental")))
{ {
break; break;
} }
this->AppendTarget(fout, ti->first, 0, this->AppendTarget(fout, targetName, 0,
make.c_str(), *lg, compiler.c_str()); make.c_str(), *lg, compiler.c_str());
break; break;
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
@ -358,11 +358,10 @@ void cmExtraCodeBlocksGenerator
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
{ {
cmGeneratorTarget* gt = cmGeneratorTarget* gt = *ti;
this->GlobalGenerator->GetGeneratorTarget(&ti->second); this->AppendTarget(fout, targetName, gt,
this->AppendTarget(fout, ti->first, gt,
make.c_str(), *lg, compiler.c_str()); make.c_str(), *lg, compiler.c_str());
std::string fastTarget = ti->first; std::string fastTarget = targetName;
fastTarget += "/fast"; fastTarget += "/fast";
this->AppendTarget(fout, fastTarget, gt, this->AppendTarget(fout, fastTarget, gt,
make.c_str(), *lg, compiler.c_str()); make.c_str(), *lg, compiler.c_str());
@ -388,11 +387,11 @@ void cmExtraCodeBlocksGenerator
lg!=lgs.end(); lg++) lg!=lgs.end(); lg++)
{ {
cmMakefile* makefile=(*lg)->GetMakefile(); cmMakefile* makefile=(*lg)->GetMakefile();
cmTargets& targets=makefile->GetTargets(); std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
for (cmTargets::iterator ti = targets.begin(); for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ti++) ti != targets.end(); ti++)
{ {
switch(ti->second.GetType()) switch((*ti)->GetType())
{ {
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
@ -402,8 +401,7 @@ void cmExtraCodeBlocksGenerator
case cmState::UTILITY: // can have sources since 2.6.3 case cmState::UTILITY: // can have sources since 2.6.3
{ {
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
cmGeneratorTarget* gt = cmGeneratorTarget* gt = *ti;
this->GlobalGenerator->GetGeneratorTarget(&ti->second);
gt->GetSourceFiles(sources, gt->GetSourceFiles(sources,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin(); for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
@ -442,7 +440,7 @@ void cmExtraCodeBlocksGenerator
} }
CbpUnit &cbpUnit = allFiles[fullPath]; CbpUnit &cbpUnit = allFiles[fullPath];
cbpUnit.Targets.push_back(&(ti->second)); cbpUnit.Targets.push_back(*ti);
} }
} }
default: // intended fallthrough default: // intended fallthrough
@ -502,8 +500,9 @@ void cmExtraCodeBlocksGenerator
fout<<" <Unit filename=\""<< cmXMLSafe(unitFilename) <<"\">\n"; fout<<" <Unit filename=\""<< cmXMLSafe(unitFilename) <<"\">\n";
for(std::vector<const cmTarget*>::const_iterator ti = unit.Targets.begin(); for(std::vector<const cmGeneratorTarget*>::const_iterator ti =
ti != unit.Targets.end(); ++ti) unit.Targets.begin();
ti != unit.Targets.end(); ++ti)
{ {
std::string const& targetName = (*ti)->GetName(); std::string const& targetName = (*ti)->GetName();
fout<<" <Option target=\""<< cmXMLSafe(targetName) <<"\"/>\n"; fout<<" <Option target=\""<< cmXMLSafe(targetName) <<"\"/>\n";
@ -561,7 +560,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
fout<<" <Target title=\"" << targetName << "\">\n"; fout<<" <Target title=\"" << targetName << "\">\n";
if (target!=0) if (target!=0)
{ {
int cbTargetType = this->GetCBTargetType(target->Target); int cbTargetType = this->GetCBTargetType(target);
std::string workingDir = lg->GetCurrentBinaryDirectory(); std::string workingDir = lg->GetCurrentBinaryDirectory();
if ( target->GetType()==cmState::EXECUTABLE) if ( target->GetType()==cmState::EXECUTABLE)
{ {
@ -719,7 +718,7 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
// Translate the cmake target type into the CodeBlocks target type id // Translate the cmake target type into the CodeBlocks target type id
int cmExtraCodeBlocksGenerator::GetCBTargetType(cmTarget* target) int cmExtraCodeBlocksGenerator::GetCBTargetType(cmGeneratorTarget* target)
{ {
if ( target->GetType()==cmState::EXECUTABLE) if ( target->GetType()==cmState::EXECUTABLE)
{ {

View File

@ -18,7 +18,6 @@
class cmLocalGenerator; class cmLocalGenerator;
class cmMakefile; class cmMakefile;
class cmGeneratorTarget; class cmGeneratorTarget;
class cmTarget;
class cmGeneratedFileStream; class cmGeneratedFileStream;
/** \class cmExtraCodeBlocksGenerator /** \class cmExtraCodeBlocksGenerator
@ -42,7 +41,7 @@ public:
private: private:
struct CbpUnit struct CbpUnit
{ {
std::vector<const cmTarget*> Targets; std::vector<const cmGeneratorTarget*> Targets;
}; };
void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs); void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
@ -53,7 +52,7 @@ private:
cmGeneratorTarget* target) const; cmGeneratorTarget* target) const;
std::string GetCBCompilerId(const cmMakefile* mf); std::string GetCBCompilerId(const cmMakefile* mf);
int GetCBTargetType(cmTarget* target); int GetCBTargetType(cmGeneratorTarget* target);
std::string BuildMakeCommand(const std::string& make, const char* makefile, std::string BuildMakeCommand(const std::string& make, const char* makefile,
const std::string& target); const std::string& target);
void AppendTarget(cmGeneratedFileStream& fout, void AppendTarget(cmGeneratedFileStream& fout,

View File

@ -155,12 +155,12 @@ void cmExtraCodeLiteGenerator
lg!=lgs.end(); lg++) lg!=lgs.end(); lg++)
{ {
cmMakefile* makefile=(*lg)->GetMakefile(); cmMakefile* makefile=(*lg)->GetMakefile();
cmTargets& targets=makefile->GetTargets(); std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
for (cmTargets::iterator ti = targets.begin(); for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ti++) ti != targets.end(); ti++)
{ {
switch(ti->second.GetType()) switch((*ti)->GetType())
{ {
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
{ {
@ -186,7 +186,7 @@ void cmExtraCodeLiteGenerator
break; break;
} }
switch(ti->second.GetType()) switch((*ti)->GetType())
{ {
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
@ -194,8 +194,7 @@ void cmExtraCodeLiteGenerator
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
{ {
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
cmGeneratorTarget* gt = cmGeneratorTarget* gt = *ti;
this->GlobalGenerator->GetGeneratorTarget(&ti->second);
gt->GetSourceFiles(sources, gt->GetSourceFiles(sources,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin(); for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();

View File

@ -536,13 +536,15 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
++lgIt) ++lgIt)
{ {
cmMakefile* makefile = (*lgIt)->GetMakefile(); cmMakefile* makefile = (*lgIt)->GetMakefile();
const cmTargets& targets = makefile->GetTargets(); const std::vector<cmGeneratorTarget*> targets =
(*lgIt)->GetGeneratorTargets();
for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end();++ti) for(std::vector<cmGeneratorTarget*>::const_iterator ti=targets.begin();
ti!=targets.end();++ti)
{ {
std::string linkName2 = linkName; std::string linkName2 = linkName;
linkName2 += "/"; linkName2 += "/";
switch(ti->second.GetType()) switch((*ti)->GetType())
{ {
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
@ -550,10 +552,10 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
{ {
const char* prefix = (ti->second.GetType()==cmState::EXECUTABLE ? const char* prefix = ((*ti)->GetType()==cmState::EXECUTABLE ?
"[exe] " : "[lib] "); "[exe] " : "[lib] ");
linkName2 += prefix; linkName2 += prefix;
linkName2 += ti->first; linkName2 += (*ti)->GetName();
this->AppendLinkedResource(fout, linkName2, "virtual:/virtual", this->AppendLinkedResource(fout, linkName2, "virtual:/virtual",
VirtualFolder); VirtualFolder);
if (!this->GenerateLinkedResources) if (!this->GenerateLinkedResources)
@ -562,10 +564,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
} }
std::vector<cmSourceGroup> sourceGroups=makefile->GetSourceGroups(); std::vector<cmSourceGroup> sourceGroups=makefile->GetSourceGroups();
// get the files from the source lists then add them to the groups // get the files from the source lists then add them to the groups
cmTarget* tgt = const_cast<cmTarget*>(&ti->second); cmGeneratorTarget* gt = const_cast<cmGeneratorTarget*>(*ti);
std::vector<cmSourceFile*> files; std::vector<cmSourceFile*> files;
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(tgt);
gt->GetSourceFiles(files, gt->GetSourceFiles(files,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin(); for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin();
@ -965,13 +965,13 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
it != this->GlobalGenerator->GetLocalGenerators().end(); it != this->GlobalGenerator->GetLocalGenerators().end();
++it) ++it)
{ {
cmGeneratorTargetsType targets = (*it)->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> targets = (*it)->GetGeneratorTargets();
for (cmGeneratorTargetsType::iterator l = targets.begin(); for (std::vector<cmGeneratorTarget*>::iterator l = targets.begin();
l != targets.end(); ++l) l != targets.end(); ++l)
{ {
std::vector<std::string> includeDirs; std::vector<std::string> includeDirs;
std::string config = mf->GetSafeDefinition("CMAKE_BUILD_TYPE"); std::string config = mf->GetSafeDefinition("CMAKE_BUILD_TYPE");
(*it)->GetIncludeDirectories(includeDirs, l->second, "C", config); (*it)->GetIncludeDirectories(includeDirs, *l, "C", config);
this->AppendIncludeDirectories(fout, includeDirs, emmited); this->AppendIncludeDirectories(fout, includeDirs, emmited);
} }
} }
@ -1030,7 +1030,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
it != this->GlobalGenerator->GetLocalGenerators().end(); it != this->GlobalGenerator->GetLocalGenerators().end();
++it) ++it)
{ {
const cmTargets& targets = (*it)->GetMakefile()->GetTargets(); const std::vector<cmGeneratorTarget*> targets =
(*it)->GetGeneratorTargets();
std::string subdir = (*it)->Convert((*it)->GetCurrentBinaryDirectory(), std::string subdir = (*it)->Convert((*it)->GetCurrentBinaryDirectory(),
cmLocalGenerator::HOME_OUTPUT); cmLocalGenerator::HOME_OUTPUT);
if (subdir == ".") if (subdir == ".")
@ -1038,9 +1039,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
subdir = ""; subdir = "";
} }
for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti) for(std::vector<cmGeneratorTarget*>::const_iterator ti =
targets.begin(); ti!=targets.end(); ++ti)
{ {
switch(ti->second.GetType()) std::string targetName = (*ti)->GetName();
switch((*ti)->GetType())
{ {
case cmState::GLOBAL_TARGET: case cmState::GLOBAL_TARGET:
{ {
@ -1048,22 +1051,22 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// not from the subdirs // not from the subdirs
if (subdir.empty()) if (subdir.empty())
{ {
this->AppendTarget(fout, ti->first, make, makeArgs, subdir, ": "); this->AppendTarget(fout, targetName, make, makeArgs, subdir, ": ");
} }
} }
break; break;
case cmState::UTILITY: case cmState::UTILITY:
// Add all utility targets, except the Nightly/Continuous/ // Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart // Experimental-"sub"targets as e.g. NightlyStart
if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly")) if (((targetName.find("Nightly")==0) &&(targetName!="Nightly"))
|| ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous")) || ((targetName.find("Continuous")==0)&&(targetName!="Continuous"))
|| ((ti->first.find("Experimental")==0) || ((targetName.find("Experimental")==0)
&& (ti->first!="Experimental"))) && (targetName!="Experimental")))
{ {
break; break;
} }
this->AppendTarget(fout, ti->first, make, makeArgs, subdir, ": "); this->AppendTarget(fout, targetName, make, makeArgs, subdir, ": ");
break; break;
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
@ -1071,10 +1074,10 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
{ {
const char* prefix = (ti->second.GetType()==cmState::EXECUTABLE ? const char* prefix = ((*ti)->GetType()==cmState::EXECUTABLE ?
"[exe] " : "[lib] "); "[exe] " : "[lib] ");
this->AppendTarget(fout, ti->first, make, makeArgs, subdir, prefix); this->AppendTarget(fout, targetName, make, makeArgs, subdir, prefix);
std::string fastTarget = ti->first; std::string fastTarget = targetName;
fastTarget += "/fast"; fastTarget += "/fast";
this->AppendTarget(fout, fastTarget, make, makeArgs, subdir, prefix); this->AppendTarget(fout, fastTarget, make, makeArgs, subdir, prefix);
@ -1083,21 +1086,20 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
{ {
std::string virtDir = "[Targets]/"; std::string virtDir = "[Targets]/";
virtDir += prefix; virtDir += prefix;
virtDir += ti->first; virtDir += targetName;
std::string buildArgs = "-C \""; std::string buildArgs = "-C \"";
buildArgs += (*it)->GetBinaryDirectory(); buildArgs += (*it)->GetBinaryDirectory();
buildArgs += "\" "; buildArgs += "\" ";
buildArgs += makeArgs; buildArgs += makeArgs;
this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "", this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "",
ti->first.c_str()); targetName.c_str());
std::string cleanArgs = "-E chdir \""; std::string cleanArgs = "-E chdir \"";
cleanArgs += (*it)->GetCurrentBinaryDirectory(); cleanArgs += (*it)->GetCurrentBinaryDirectory();
cleanArgs += "\" \""; cleanArgs += "\" \"";
cleanArgs += cmSystemTools::GetCMakeCommand(); cleanArgs += cmSystemTools::GetCMakeCommand();
cleanArgs += "\" -P \""; cleanArgs += "\" -P \"";
cmGeneratorTarget* gt = cmGeneratorTarget* gt = *ti;
this->GlobalGenerator->GetGeneratorTarget(&ti->second);
cleanArgs += (*it)->GetTargetDirectory(gt); cleanArgs += (*it)->GetTargetDirectory(gt);
cleanArgs += "/cmake_clean.cmake\""; cleanArgs += "/cmake_clean.cmake\"";
this->AppendTarget(fout, "Clean", cmSystemTools::GetCMakeCommand(), this->AppendTarget(fout, "Clean", cmSystemTools::GetCMakeCommand(),

View File

@ -119,14 +119,16 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
it != this->GlobalGenerator->GetLocalGenerators().end(); it != this->GlobalGenerator->GetLocalGenerators().end();
++it) ++it)
{ {
const cmTargets& targets = (*it)->GetMakefile()->GetTargets(); const std::vector<cmGeneratorTarget*> targets =
cmMakefile* makefile=(*it)->GetMakefile(); (*it)->GetGeneratorTargets();
std::string currentDir = (*it)->GetCurrentBinaryDirectory(); std::string currentDir = (*it)->GetCurrentBinaryDirectory();
bool topLevel = (currentDir == (*it)->GetBinaryDirectory()); bool topLevel = (currentDir == (*it)->GetBinaryDirectory());
for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti) for(std::vector<cmGeneratorTarget*>::const_iterator ti =
targets.begin(); ti!=targets.end(); ++ti)
{ {
switch(ti->second.GetType()) std::string targetName = (*ti)->GetName();
switch((*ti)->GetType())
{ {
case cmState::GLOBAL_TARGET: case cmState::GLOBAL_TARGET:
{ {
@ -138,9 +140,9 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
insertTarget = true; insertTarget = true;
// only add the "edit_cache" target if it's not ccmake, because // only add the "edit_cache" target if it's not ccmake, because
// this will not work within the IDE // this will not work within the IDE
if (ti->first == "edit_cache") if (targetName == "edit_cache")
{ {
const char* editCommand = makefile->GetDefinition const char* editCommand = (*it)->GetMakefile()->GetDefinition
("CMAKE_EDIT_COMMAND"); ("CMAKE_EDIT_COMMAND");
if (editCommand == 0) if (editCommand == 0)
{ {
@ -154,7 +156,7 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
} }
if (insertTarget) if (insertTarget)
{ {
this->AppendTarget(fout, ti->first, make, makeArgs, this->AppendTarget(fout, targetName, make, makeArgs,
currentDir, homeOutputDir); currentDir, homeOutputDir);
} }
} }
@ -162,15 +164,16 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
case cmState::UTILITY: case cmState::UTILITY:
// Add all utility targets, except the Nightly/Continuous/ // Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart // Experimental-"sub"targets as e.g. NightlyStart
if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly")) if (((targetName.find("Nightly")==0) &&(targetName!="Nightly"))
|| ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous")) || ((targetName.find("Continuous")==0)
|| ((ti->first.find("Experimental")==0) &&(targetName!="Continuous"))
&& (ti->first!="Experimental"))) || ((targetName.find("Experimental")==0)
&& (targetName!="Experimental")))
{ {
break; break;
} }
this->AppendTarget(fout, ti->first, make, makeArgs, this->AppendTarget(fout, targetName, make, makeArgs,
currentDir, homeOutputDir); currentDir, homeOutputDir);
break; break;
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
@ -179,9 +182,9 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
{ {
this->AppendTarget(fout, ti->first, make, makeArgs, this->AppendTarget(fout, targetName, make, makeArgs,
currentDir, homeOutputDir); currentDir, homeOutputDir);
std::string fastTarget = ti->first; std::string fastTarget = targetName;
fastTarget += "/fast"; fastTarget += "/fast";
this->AppendTarget(fout, fastTarget, make, makeArgs, this->AppendTarget(fout, fastTarget, make, makeArgs,
currentDir, homeOutputDir); currentDir, homeOutputDir);

View File

@ -20,7 +20,6 @@
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmTarget.h"
#include <cmsys/SystemTools.hxx> #include <cmsys/SystemTools.hxx>
@ -162,11 +161,12 @@ void cmExtraSublimeTextGenerator::
lg!=lgs.end(); lg++) lg!=lgs.end(); lg++)
{ {
cmMakefile* makefile=(*lg)->GetMakefile(); cmMakefile* makefile=(*lg)->GetMakefile();
cmTargets& targets=makefile->GetTargets(); std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
for (cmTargets::iterator ti = targets.begin(); for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ti++) ti != targets.end(); ti++)
{ {
switch(ti->second.GetType()) std::string targetName = (*ti)->GetName();
switch((*ti)->GetType())
{ {
case cmState::GLOBAL_TARGET: case cmState::GLOBAL_TARGET:
{ {
@ -175,7 +175,7 @@ void cmExtraSublimeTextGenerator::
if (strcmp((*lg)->GetCurrentBinaryDirectory(), if (strcmp((*lg)->GetCurrentBinaryDirectory(),
(*lg)->GetBinaryDirectory())==0) (*lg)->GetBinaryDirectory())==0)
{ {
this->AppendTarget(fout, ti->first, *lg, 0, this->AppendTarget(fout, targetName, *lg, 0,
make.c_str(), makefile, compiler.c_str(), make.c_str(), makefile, compiler.c_str(),
sourceFileFlags, false); sourceFileFlags, false);
} }
@ -184,15 +184,16 @@ void cmExtraSublimeTextGenerator::
case cmState::UTILITY: case cmState::UTILITY:
// Add all utility targets, except the Nightly/Continuous/ // Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart // Experimental-"sub"targets as e.g. NightlyStart
if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly")) if (((targetName.find("Nightly")==0) &&(targetName!="Nightly"))
|| ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous")) || ((targetName.find("Continuous")==0)
|| ((ti->first.find("Experimental")==0) &&(targetName!="Continuous"))
&& (ti->first!="Experimental"))) || ((targetName.find("Experimental")==0)
&& (targetName!="Experimental")))
{ {
break; break;
} }
this->AppendTarget(fout, ti->first, *lg, 0, this->AppendTarget(fout, targetName, *lg, 0,
make.c_str(), makefile, compiler.c_str(), make.c_str(), makefile, compiler.c_str(),
sourceFileFlags, false); sourceFileFlags, false);
break; break;
@ -202,12 +203,12 @@ void cmExtraSublimeTextGenerator::
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
{ {
this->AppendTarget(fout, ti->first, *lg, &ti->second, this->AppendTarget(fout, targetName, *lg, *ti,
make.c_str(), makefile, compiler.c_str(), make.c_str(), makefile, compiler.c_str(),
sourceFileFlags, false); sourceFileFlags, false);
std::string fastTarget = ti->first; std::string fastTarget = targetName;
fastTarget += "/fast"; fastTarget += "/fast";
this->AppendTarget(fout, fastTarget, *lg, &ti->second, this->AppendTarget(fout, fastTarget, *lg, *ti,
make.c_str(), makefile, compiler.c_str(), make.c_str(), makefile, compiler.c_str(),
sourceFileFlags, false); sourceFileFlags, false);
} }
@ -223,7 +224,7 @@ void cmExtraSublimeTextGenerator::
AppendTarget(cmGeneratedFileStream& fout, AppendTarget(cmGeneratedFileStream& fout,
const std::string& targetName, const std::string& targetName,
cmLocalGenerator* lg, cmLocalGenerator* lg,
cmTarget* target, cmGeneratorTarget* target,
const char* make, const char* make,
const cmMakefile* makefile, const cmMakefile* makefile,
const char*, //compiler const char*, //compiler
@ -233,10 +234,8 @@ void cmExtraSublimeTextGenerator::
if (target != 0) if (target != 0)
{ {
cmGeneratorTarget *gtgt = this->GlobalGenerator
->GetGeneratorTarget(target);
std::vector<cmSourceFile*> sourceFiles; std::vector<cmSourceFile*> sourceFiles;
gtgt->GetSourceFiles(sourceFiles, target->GetSourceFiles(sourceFiles,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
std::vector<cmSourceFile*>::const_iterator sourceFilesEnd = std::vector<cmSourceFile*>::const_iterator sourceFilesEnd =
sourceFiles.end(); sourceFiles.end();
@ -254,9 +253,9 @@ void cmExtraSublimeTextGenerator::
} }
std::vector<std::string>& flags = sourceFileFlagsIter->second; std::vector<std::string>& flags = sourceFileFlagsIter->second;
std::string flagsString = std::string flagsString =
this->ComputeFlagsForObject(*iter, lg, gtgt); this->ComputeFlagsForObject(*iter, lg, target);
std::string definesString = std::string definesString =
this->ComputeDefines(*iter, lg, gtgt); this->ComputeDefines(*iter, lg, target);
flags.clear(); flags.clear();
cmsys::RegularExpression flagRegex; cmsys::RegularExpression flagRegex;
// Regular expression to extract compiler flags from a string // Regular expression to extract compiler flags from a string

View File

@ -18,7 +18,6 @@
class cmLocalGenerator; class cmLocalGenerator;
class cmMakefile; class cmMakefile;
class cmTarget;
class cmGeneratedFileStream; class cmGeneratedFileStream;
class cmGeneratorTarget; class cmGeneratorTarget;
@ -67,7 +66,7 @@ private:
void AppendTarget(cmGeneratedFileStream& fout, void AppendTarget(cmGeneratedFileStream& fout,
const std::string& targetName, const std::string& targetName,
cmLocalGenerator* lg, cmLocalGenerator* lg,
cmTarget* target, cmGeneratorTarget* target,
const char* make, const char* make,
const cmMakefile* makefile, const cmMakefile* makefile,
const char* compiler, const char* compiler,

View File

@ -3607,14 +3607,14 @@ std::string cmGeneratorTarget::GetPDBName(const std::string& config) const
return prefix+base+".pdb"; return prefix+base+".pdb";
} }
bool cmStrictTargetComparison::operator()(cmTarget const* t1, bool cmGeneratorTarget::StrictTargetComparison::operator()(
cmTarget const* t2) const cmGeneratorTarget const* t1, cmGeneratorTarget const* t2) const
{ {
int nameResult = strcmp(t1->GetName().c_str(), t2->GetName().c_str()); int nameResult = strcmp(t1->GetName().c_str(), t2->GetName().c_str());
if (nameResult == 0) if (nameResult == 0)
{ {
return strcmp(t1->GetMakefile()->GetCurrentBinaryDirectory(), return strcmp(t1->GetLocalGenerator()->GetCurrentBinaryDirectory(),
t2->GetMakefile()->GetCurrentBinaryDirectory()) < 0; t2->GetLocalGenerator()->GetCurrentBinaryDirectory()) < 0;
} }
return nameResult < 0; return nameResult < 0;
} }

View File

@ -673,14 +673,11 @@ public:
{ {
return this->MaxLanguageStandards; return this->MaxLanguageStandards;
} }
};
struct cmStrictTargetComparison { struct StrictTargetComparison {
bool operator()(cmTarget const* t1, cmTarget const* t2) const; bool operator()(cmGeneratorTarget const* t1,
cmGeneratorTarget const* t2) const;
};
}; };
typedef std::map<cmTarget const*,
cmGeneratorTarget*,
cmStrictTargetComparison> cmGeneratorTargetsType;
#endif #endif

View File

@ -22,23 +22,22 @@
std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic"); std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic");
cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget *target) cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget *target)
: Target(target->Target) : GeneratorTarget(target)
, GeneratorTarget(target)
, LocalGenerator(static_cast<cmLocalGhsMultiGenerator *>( , LocalGenerator(static_cast<cmLocalGhsMultiGenerator *>(
target->GetLocalGenerator())) target->GetLocalGenerator()))
, Makefile(target->Target->GetMakefile()) , Makefile(target->Target->GetMakefile())
, TargetGroup(DetermineIfTargetGroup(target)) , TargetGroup(DetermineIfTargetGroup(target))
, DynamicDownload(false) , DynamicDownload(false)
{ {
this->RelBuildFilePath = this->GetRelBuildFilePath(target->Target); this->RelBuildFilePath = this->GetRelBuildFilePath(target);
this->RelOutputFileName = this->RelOutputFileName =
this->RelBuildFilePath + this->Target->GetName() + ".a"; this->RelBuildFilePath + target->GetName() + ".a";
this->RelBuildFileName = this->RelBuildFilePath; this->RelBuildFileName = this->RelBuildFilePath;
this->RelBuildFileName += this->GetBuildFileName(target->Target); this->RelBuildFileName += this->GetBuildFileName(target);
std::string absPathToRoot = this->GetAbsPathToRoot(target->Target); std::string absPathToRoot = this->GetAbsPathToRoot(target);
absPathToRoot = this->AddSlashIfNeededToPath(absPathToRoot); absPathToRoot = this->AddSlashIfNeededToPath(absPathToRoot);
this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath; this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath;
this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName; this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName;
@ -51,7 +50,8 @@ cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator()
} }
std::string std::string
cmGhsMultiTargetGenerator::GetRelBuildFilePath(const cmTarget *target) cmGhsMultiTargetGenerator::GetRelBuildFilePath(
const cmGeneratorTarget *target)
{ {
std::string output; std::string output;
char const *folderProp = target->GetProperty("FOLDER"); char const *folderProp = target->GetProperty("FOLDER");
@ -66,15 +66,13 @@ cmGhsMultiTargetGenerator::GetRelBuildFilePath(const cmTarget *target)
} }
std::string std::string
cmGhsMultiTargetGenerator::GetAbsPathToRoot(const cmTarget *target) cmGhsMultiTargetGenerator::GetAbsPathToRoot(const cmGeneratorTarget *target)
{ {
cmGeneratorTarget* gt = target->GetMakefile()->GetGlobalGenerator() return target->GetLocalGenerator()->GetBinaryDirectory();
->GetGeneratorTarget(target);
return gt->GetLocalGenerator()->GetBinaryDirectory();
} }
std::string std::string
cmGhsMultiTargetGenerator::GetAbsBuildFilePath(const cmTarget *target) cmGhsMultiTargetGenerator::GetAbsBuildFilePath(const cmGeneratorTarget *target)
{ {
std::string output; std::string output;
output = cmGhsMultiTargetGenerator::GetAbsPathToRoot(target); output = cmGhsMultiTargetGenerator::GetAbsPathToRoot(target);
@ -84,7 +82,7 @@ cmGhsMultiTargetGenerator::GetAbsBuildFilePath(const cmTarget *target)
} }
std::string std::string
cmGhsMultiTargetGenerator::GetRelBuildFileName(const cmTarget *target) cmGhsMultiTargetGenerator::GetRelBuildFileName(const cmGeneratorTarget *target)
{ {
std::string output; std::string output;
output = cmGhsMultiTargetGenerator::GetRelBuildFilePath(target); output = cmGhsMultiTargetGenerator::GetRelBuildFilePath(target);
@ -93,7 +91,8 @@ cmGhsMultiTargetGenerator::GetRelBuildFileName(const cmTarget *target)
return output; return output;
} }
std::string cmGhsMultiTargetGenerator::GetBuildFileName(const cmTarget *target) std::string
cmGhsMultiTargetGenerator::GetBuildFileName(const cmGeneratorTarget *target)
{ {
std::string output; std::string output;
output = target->GetName(); output = target->GetName();
@ -161,7 +160,8 @@ void cmGhsMultiTargetGenerator::Generate()
bool cmGhsMultiTargetGenerator::IncludeThisTarget() bool cmGhsMultiTargetGenerator::IncludeThisTarget()
{ {
bool output = true; bool output = true;
char const *excludeFromAll = this->Target->GetProperty("EXCLUDE_FROM_ALL"); char const *excludeFromAll =
this->GeneratorTarget->GetProperty("EXCLUDE_FROM_ALL");
if (NULL != excludeFromAll && '1' == excludeFromAll[0] && if (NULL != excludeFromAll && '1' == excludeFromAll[0] &&
'\0' == excludeFromAll[1]) '\0' == excludeFromAll[1])
{ {
@ -367,13 +367,13 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end(); for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end();
++tdsI) ++tdsI)
{ {
const cmTarget *tg = (*tdsI)->Target; const cmGeneratorTarget *tg = *tdsI;
*this->GetFolderBuildStreams() << " -L\"" << GetAbsBuildFilePath(tg) *this->GetFolderBuildStreams() << " -L\"" << GetAbsBuildFilePath(tg)
<< "\"" << std::endl; << "\"" << std::endl;
} }
// library targets // library targets
cmTarget::LinkLibraryVectorType llv = cmTarget::LinkLibraryVectorType llv =
this->Target->GetOriginalLinkLibraries(); this->GeneratorTarget->Target->GetOriginalLinkLibraries();
for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin(); for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin();
llvI != llv.end(); ++llvI) llvI != llv.end(); ++llvI)
{ {
@ -391,10 +391,12 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
void cmGhsMultiTargetGenerator::WriteCustomCommands() void cmGhsMultiTargetGenerator::WriteCustomCommands()
{ {
WriteCustomCommandsHelper(this->Target->GetPreBuildCommands(), WriteCustomCommandsHelper(
cmTarget::PRE_BUILD); this->GeneratorTarget->Target->GetPreBuildCommands(),
WriteCustomCommandsHelper(this->Target->GetPostBuildCommands(), cmTarget::PRE_BUILD);
cmTarget::POST_BUILD); WriteCustomCommandsHelper(
this->GeneratorTarget->Target->GetPostBuildCommands(),
cmTarget::POST_BUILD);
} }
void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
@ -518,7 +520,7 @@ cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const
std::string outputDir(AbsBuildFilePath); std::string outputDir(AbsBuildFilePath);
const char *runtimeOutputProp = const char *runtimeOutputProp =
this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY"); this->GeneratorTarget->GetProperty("RUNTIME_OUTPUT_DIRECTORY");
if (NULL != runtimeOutputProp) if (NULL != runtimeOutputProp)
{ {
outputDir = runtimeOutputProp; outputDir = runtimeOutputProp;
@ -526,7 +528,8 @@ cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const
std::string configCapped(cmSystemTools::UpperCase(config)); std::string configCapped(cmSystemTools::UpperCase(config));
const char *runtimeOutputSProp = const char *runtimeOutputSProp =
this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped); this->GeneratorTarget
->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped);
if (NULL != runtimeOutputSProp) if (NULL != runtimeOutputSProp)
{ {
outputDir = runtimeOutputSProp; outputDir = runtimeOutputSProp;
@ -544,9 +547,10 @@ cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const
std::string std::string
cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const
{ {
std::string outputFilename(this->Target->GetName()); std::string outputFilename(this->GeneratorTarget->GetName());
const char *outputNameProp = this->Target->GetProperty("OUTPUT_NAME"); const char *outputNameProp =
this->GeneratorTarget->GetProperty("OUTPUT_NAME");
if (NULL != outputNameProp) if (NULL != outputNameProp)
{ {
outputFilename = outputNameProp; outputFilename = outputNameProp;
@ -554,7 +558,7 @@ cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const
std::string configCapped(cmSystemTools::UpperCase(config)); std::string configCapped(cmSystemTools::UpperCase(config));
const char *outputNameSProp = const char *outputNameSProp =
this->Target->GetProperty(configCapped + "_OUTPUT_NAME"); this->GeneratorTarget->GetProperty(configCapped + "_OUTPUT_NAME");
if (NULL != outputNameSProp) if (NULL != outputNameSProp)
{ {
outputFilename = outputNameSProp; outputFilename = outputNameSProp;

View File

@ -54,11 +54,11 @@ public:
return this->AbsOutputFileName.c_str(); return this->AbsOutputFileName.c_str();
} }
static std::string GetRelBuildFilePath(const cmTarget *target); static std::string GetRelBuildFilePath(const cmGeneratorTarget *target);
static std::string GetAbsPathToRoot(const cmTarget *target); static std::string GetAbsPathToRoot(const cmGeneratorTarget *target);
static std::string GetAbsBuildFilePath(const cmTarget *target); static std::string GetAbsBuildFilePath(const cmGeneratorTarget *target);
static std::string GetRelBuildFileName(const cmTarget *target); static std::string GetRelBuildFileName(const cmGeneratorTarget *target);
static std::string GetBuildFileName(const cmTarget *target); static std::string GetBuildFileName(const cmGeneratorTarget *target);
static std::string AddSlashIfNeededToPath(std::string const &input); static std::string AddSlashIfNeededToPath(std::string const &input);
private: private:
@ -99,7 +99,6 @@ private:
bool DetermineIfDynamicDownload(std::string const &config, bool DetermineIfDynamicDownload(std::string const &config,
const std::string &language); const std::string &language);
cmTarget *Target;
cmGeneratorTarget* GeneratorTarget; cmGeneratorTarget* GeneratorTarget;
cmLocalGhsMultiGenerator *LocalGenerator; cmLocalGhsMultiGenerator *LocalGenerator;
cmMakefile *Makefile; cmMakefile *Makefile;

View File

@ -48,6 +48,18 @@
#include <assert.h> #include <assert.h>
bool cmTarget::StrictTargetComparison::operator()(cmTarget const* t1,
cmTarget const* t2) const
{
int nameResult = strcmp(t1->GetName().c_str(), t2->GetName().c_str());
if (nameResult == 0)
{
return strcmp(t1->GetMakefile()->GetCurrentBinaryDirectory(),
t2->GetMakefile()->GetCurrentBinaryDirectory()) < 0;
}
return nameResult < 0;
}
cmGlobalGenerator::cmGlobalGenerator(cmake* cm) cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
: CMakeInstance(cm) : CMakeInstance(cm)
{ {
@ -1456,34 +1468,34 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{ {
cmTargets& targets = std::vector<cmGeneratorTarget*> targets =
this->LocalGenerators[i]->GetMakefile()->GetTargets(); this->LocalGenerators[i]->GetGeneratorTargets();
std::vector<cmGeneratorTarget*> filteredTargets; std::vector<cmGeneratorTarget*> filteredTargets;
filteredTargets.reserve(targets.size()); filteredTargets.reserve(targets.size());
for(cmTargets::iterator ti = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ++ti) ti != targets.end(); ++ti)
{ {
if (ti->second.GetType() == cmState::GLOBAL_TARGET) if ((*ti)->GetType() == cmState::GLOBAL_TARGET)
{ {
continue; continue;
} }
if(ti->second.GetType() != cmState::EXECUTABLE && if((*ti)->GetType() != cmState::EXECUTABLE &&
ti->second.GetType() != cmState::STATIC_LIBRARY && (*ti)->GetType() != cmState::STATIC_LIBRARY &&
ti->second.GetType() != cmState::SHARED_LIBRARY && (*ti)->GetType() != cmState::SHARED_LIBRARY &&
ti->second.GetType() != cmState::MODULE_LIBRARY && (*ti)->GetType() != cmState::MODULE_LIBRARY &&
ti->second.GetType() != cmState::OBJECT_LIBRARY) (*ti)->GetType() != cmState::OBJECT_LIBRARY)
{ {
continue; continue;
} }
if((!ti->second.GetPropertyAsBool("AUTOMOC") if((!(*ti)->GetPropertyAsBool("AUTOMOC")
&& !ti->second.GetPropertyAsBool("AUTOUIC") && !(*ti)->GetPropertyAsBool("AUTOUIC")
&& !ti->second.GetPropertyAsBool("AUTORCC")) && !(*ti)->GetPropertyAsBool("AUTORCC"))
|| ti->second.IsImported()) || (*ti)->IsImported())
{ {
continue; continue;
} }
// don't do anything if there is no Qt4 or Qt5Core (which contains moc): // don't do anything if there is no Qt4 or Qt5Core (which contains moc):
cmMakefile* mf = ti->second.GetMakefile(); cmMakefile* mf = (*ti)->Target->GetMakefile();
std::string qtMajorVersion = mf->GetSafeDefinition("QT_VERSION_MAJOR"); std::string qtMajorVersion = mf->GetSafeDefinition("QT_VERSION_MAJOR");
if (qtMajorVersion == "") if (qtMajorVersion == "")
{ {
@ -1494,7 +1506,7 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
continue; continue;
} }
cmGeneratorTarget* gt = this->GetGeneratorTarget(&ti->second); cmGeneratorTarget* gt = *ti;
cmQtAutoGeneratorInitializer::InitializeAutogenSources(gt); cmQtAutoGeneratorInitializer::InitializeAutogenSources(gt);
filteredTargets.push_back(gt); filteredTargets.push_back(gt);
@ -1584,7 +1596,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
cmTarget* t = &ti->second; cmTarget* t = &ti->second;
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg); cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
this->GeneratorTargets[t] = gt; this->GeneratorTargets[t] = gt;
lg->AddGeneratorTarget(t, gt); lg->AddGeneratorTarget(gt);
} }
} }
@ -2694,23 +2706,22 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
{ {
continue; continue;
} }
cmMakefile* mf = (*i)->GetMakefile();
// Get the targets in the makefile // Get the targets in the makefile
cmTargets &tgts = mf->GetTargets(); std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets();
// loop over all the targets // loop over all the targets
for (cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l)
{ {
cmTarget* target = &l->second; cmGeneratorTarget* target = *l;
cmGeneratorTarget* gt = this->GetGeneratorTarget(target); if(this->IsRootOnlyTarget(target) &&
if(this->IsRootOnlyTarget(gt) && target->GetLocalGenerator() != root)
target->GetMakefile() != root->GetMakefile())
{ {
continue; continue;
} }
// put the target in the set of original targets // put the target in the set of original targets
originalTargets.insert(gt); originalTargets.insert(target);
// Get the set of targets that depend on target // Get the set of targets that depend on target
this->AddTargetDepends(gt, projectTargets); this->AddTargetDepends(target, projectTargets);
} }
} }
} }

View File

@ -42,6 +42,10 @@ class cmInstallTargetGenerator;
class cmInstallFilesGenerator; class cmInstallFilesGenerator;
class cmExportBuildFileGenerator; class cmExportBuildFileGenerator;
typedef std::map<cmTarget const*,
cmGeneratorTarget*,
cmTarget::StrictTargetComparison> cmGeneratorTargetsType;
/** \class cmGlobalGenerator /** \class cmGlobalGenerator
* \brief Responsible for overseeing the generation process for the entire tree * \brief Responsible for overseeing the generation process for the entire tree
* *

View File

@ -287,8 +287,8 @@ void cmGlobalGhsMultiGenerator::Generate()
{ {
cmLocalGhsMultiGenerator *lg = cmLocalGhsMultiGenerator *lg =
static_cast<cmLocalGhsMultiGenerator *>(this->LocalGenerators[i]); static_cast<cmLocalGhsMultiGenerator *>(this->LocalGenerators[i]);
cmGeneratorTargetsType tgts = lg->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
this->UpdateBuildFiles(&tgts); this->UpdateBuildFiles(tgts);
} }
} }
@ -481,15 +481,15 @@ cmGlobalGhsMultiGenerator::GetFileNameFromPath(std::string const &path)
} }
void cmGlobalGhsMultiGenerator::UpdateBuildFiles( void cmGlobalGhsMultiGenerator::UpdateBuildFiles(
cmGeneratorTargetsType *tgts) std::vector<cmGeneratorTarget*> tgts)
{ {
for (cmGeneratorTargetsType::iterator tgtsI = tgts->begin(); for (std::vector<cmGeneratorTarget*>::iterator tgtsI = tgts.begin();
tgtsI != tgts->end(); ++tgtsI) tgtsI != tgts.end(); ++tgtsI)
{ {
const cmTarget *tgt(tgtsI->first); const cmGeneratorTarget *tgt = *tgtsI;
if (IsTgtForBuild(tgt)) if (IsTgtForBuild(tgt))
{ {
char const *rawFolderName = tgtsI->first->GetProperty("FOLDER"); char const *rawFolderName = tgt->GetProperty("FOLDER");
if (NULL == rawFolderName) if (NULL == rawFolderName)
{ {
rawFolderName = ""; rawFolderName = "";
@ -510,19 +510,18 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles(
*this->TargetFolderBuildStreams[folderName] << foldNameRelBuildFile *this->TargetFolderBuildStreams[folderName] << foldNameRelBuildFile
<< " "; << " ";
GhsMultiGpj::WriteGpjTag(cmGhsMultiTargetGenerator::GetGpjTag( GhsMultiGpj::WriteGpjTag(cmGhsMultiTargetGenerator::GetGpjTag(
tgtsI->second), tgt),
this->TargetFolderBuildStreams[folderName]); this->TargetFolderBuildStreams[folderName]);
} }
} }
} }
bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmTarget *tgt) bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmGeneratorTarget *tgt)
{ {
const std::string config = const std::string config =
tgt->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); tgt->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
std::vector<cmSourceFile *> tgtSources; std::vector<cmSourceFile *> tgtSources;
cmGeneratorTarget* gt = this->GetGeneratorTarget(tgt); tgt->GetSourceFiles(tgtSources, config);
gt->GetSourceFiles(tgtSources, config);
bool tgtInBuild = true; bool tgtInBuild = true;
char const *excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL"); char const *excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL");
if (NULL != excludeFromAll && '1' == excludeFromAll[0] && if (NULL != excludeFromAll && '1' == excludeFromAll[0] &&

View File

@ -110,8 +110,8 @@ private:
std::vector<cmsys::String>::const_iterator end, std::vector<cmsys::String>::const_iterator end,
GhsMultiGpj::Types projType); GhsMultiGpj::Types projType);
static std::string GetFileNameFromPath(std::string const &path); static std::string GetFileNameFromPath(std::string const &path);
void UpdateBuildFiles(cmGeneratorTargetsType *tgts); void UpdateBuildFiles(std::vector<cmGeneratorTarget*> tgts);
bool IsTgtForBuild(const cmTarget *tgt); bool IsTgtForBuild(const cmGeneratorTarget *tgt);
std::vector<cmGeneratedFileStream *> TargetSubProjects; std::vector<cmGeneratedFileStream *> TargetSubProjects;
std::map<std::string, cmGeneratedFileStream *> TargetFolderBuildStreams; std::map<std::string, cmGeneratedFileStream *> TargetFolderBuildStreams;

View File

@ -68,13 +68,14 @@ void cmGlobalKdevelopGenerator::Generate()
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin(); for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
lg!=lgs.end(); lg++) lg!=lgs.end(); lg++)
{ {
cmGeneratorTargetsType const& targets = (*lg)->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> const& targets =
for (cmGeneratorTargetsType::const_iterator ti = targets.begin(); (*lg)->GetGeneratorTargets();
ti != targets.end(); ti++) for (std::vector<cmGeneratorTarget*>::const_iterator ti =
targets.begin(); ti != targets.end(); ti++)
{ {
if (ti->second->GetType()==cmState::EXECUTABLE) if ((*ti)->GetType()==cmState::EXECUTABLE)
{ {
executable = ti->second->GetLocation(""); executable = (*ti)->GetLocation("");
break; break;
} }
} }
@ -132,14 +133,13 @@ bool cmGlobalKdevelopGenerator
} }
//get all sources //get all sources
cmTargets& targets=makefile->GetTargets(); std::vector<cmGeneratorTarget*> targets=(*it)->GetGeneratorTargets();
for (cmTargets::iterator ti = targets.begin(); for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ti++) ti != targets.end(); ti++)
{ {
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
cmGeneratorTarget* gt = cmGeneratorTarget* gt = *ti;
this->GlobalGenerator->GetGeneratorTarget(&ti->second); gt->GetSourceFiles(sources, gt->Target->GetMakefile()
gt->GetSourceFiles(sources, ti->second.GetMakefile()
->GetSafeDefinition("CMAKE_BUILD_TYPE")); ->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin(); for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
si!=sources.end(); si++) si!=sources.end(); si++)

View File

@ -719,7 +719,7 @@ void cmGlobalNinjaGenerator
{ {
// Compute full path to object file directory for this target. // Compute full path to object file directory for this target.
std::string dir; std::string dir;
dir += gt->Makefile->GetCurrentBinaryDirectory(); dir += gt->LocalGenerator->GetCurrentBinaryDirectory();
dir += "/"; dir += "/";
dir += gt->LocalGenerator->GetTargetDirectory(gt); dir += gt->LocalGenerator->GetTargetDirectory(gt);
dir += "/"; dir += "/";
@ -886,7 +886,7 @@ void cmGlobalNinjaGenerator::WriteDisclaimer(std::ostream& os)
<< cmVersion::GetMinorVersion() << "\n\n"; << cmVersion::GetMinorVersion() << "\n\n";
} }
void cmGlobalNinjaGenerator::AddDependencyToAll(cmTarget* target) void cmGlobalNinjaGenerator::AddDependencyToAll(cmGeneratorTarget* target)
{ {
this->AppendTargetOutputs(target, this->AllDependencies); this->AppendTargetOutputs(target, this->AllDependencies);
} }
@ -912,18 +912,16 @@ void cmGlobalNinjaGenerator::WriteAssumedSourceDependencies()
void void
cmGlobalNinjaGenerator cmGlobalNinjaGenerator
::AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs) ::AppendTargetOutputs(cmGeneratorTarget const* target, cmNinjaDeps& outputs)
{ {
std::string configName = std::string configName =
target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(target);
// for frameworks, we want the real name, not smple name // for frameworks, we want the real name, not smple name
// frameworks always appear versioned, and the build.ninja // frameworks always appear versioned, and the build.ninja
// will always attempt to manage symbolic links instead // will always attempt to manage symbolic links instead
// of letting cmOSXBundleGenerator do it. // of letting cmOSXBundleGenerator do it.
bool realname = gtgt->IsFrameworkOnApple(); bool realname = target->IsFrameworkOnApple();
switch (target->GetType()) { switch (target->GetType()) {
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
@ -932,13 +930,13 @@ cmGlobalNinjaGenerator
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
{ {
outputs.push_back(this->ConvertToNinjaPath( outputs.push_back(this->ConvertToNinjaPath(
gtgt->GetFullPath(configName, false, realname))); target->GetFullPath(configName, false, realname)));
break; break;
} }
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
case cmState::UTILITY: { case cmState::UTILITY: {
std::string path = this->ConvertToNinjaPath( std::string path = this->ConvertToNinjaPath(
target->GetMakefile()->GetCurrentBinaryDirectory()); target->GetLocalGenerator()->GetCurrentBinaryDirectory());
if (path.empty() || path == ".") if (path.empty() || path == ".")
outputs.push_back(target->GetName()); outputs.push_back(target->GetName());
else { else {
@ -962,16 +960,15 @@ cmGlobalNinjaGenerator
void void
cmGlobalNinjaGenerator cmGlobalNinjaGenerator
::AppendTargetDepends(cmTarget const* target, cmNinjaDeps& outputs) ::AppendTargetDepends(cmGeneratorTarget const* target, cmNinjaDeps& outputs)
{ {
if (target->GetType() == cmState::GLOBAL_TARGET) { if (target->GetType() == cmState::GLOBAL_TARGET) {
// Global targets only depend on other utilities, which may not appear in // Global targets only depend on other utilities, which may not appear in
// the TargetDepends set (e.g. "all"). // the TargetDepends set (e.g. "all").
std::set<std::string> const& utils = target->GetUtilities(); std::set<std::string> const& utils = target->Target->GetUtilities();
std::copy(utils.begin(), utils.end(), std::back_inserter(outputs)); std::copy(utils.begin(), utils.end(), std::back_inserter(outputs));
} else { } else {
cmGeneratorTarget* gt = this->GetGeneratorTarget(target); cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target);
cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(gt);
for (cmTargetDependSet::const_iterator i = targetDeps.begin(); for (cmTargetDependSet::const_iterator i = targetDeps.begin();
i != targetDeps.end(); ++i) i != targetDeps.end(); ++i)
{ {
@ -979,13 +976,13 @@ cmGlobalNinjaGenerator
{ {
continue; continue;
} }
this->AppendTargetOutputs((*i)->Target, outputs); this->AppendTargetOutputs(*i, outputs);
} }
} }
} }
void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias, void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
cmTarget* target) { cmGeneratorTarget* target) {
cmNinjaDeps outputs; cmNinjaDeps outputs;
this->AppendTargetOutputs(target, outputs); this->AppendTargetOutputs(target, outputs);
// Mark the target's outputs as ambiguous to ensure that no other target uses // Mark the target's outputs as ambiguous to ensure that no other target uses

View File

@ -285,9 +285,11 @@ public:
ASD.insert(deps.begin(), deps.end()); ASD.insert(deps.begin(), deps.end());
} }
void AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs); void AppendTargetOutputs(cmGeneratorTarget const* target,
void AppendTargetDepends(cmTarget const* target, cmNinjaDeps& outputs); cmNinjaDeps& outputs);
void AddDependencyToAll(cmTarget* target); void AppendTargetDepends(cmGeneratorTarget const* target,
cmNinjaDeps& outputs);
void AddDependencyToAll(cmGeneratorTarget* target);
void AddDependencyToAll(const std::string& input); void AddDependencyToAll(const std::string& input);
const std::vector<cmLocalGenerator*>& GetLocalGenerators() const { const std::vector<cmLocalGenerator*>& GetLocalGenerators() const {
@ -299,7 +301,7 @@ public:
int GetRuleCmdLength(const std::string& name) { int GetRuleCmdLength(const std::string& name) {
return RuleCmdLength[name]; } return RuleCmdLength[name]; }
void AddTargetAlias(const std::string& alias, cmTarget* target); void AddTargetAlias(const std::string& alias, cmGeneratorTarget* target);
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
@ -388,7 +390,7 @@ private:
/// The mapping from source file to assumed dependencies. /// The mapping from source file to assumed dependencies.
std::map<std::string, std::set<std::string> > AssumedSourceDependencies; std::map<std::string, std::set<std::string> > AssumedSourceDependencies;
typedef std::map<std::string, cmTarget*> TargetAliasMap; typedef std::map<std::string, cmGeneratorTarget*> TargetAliasMap;
TargetAliasMap TargetAliases; TargetAliasMap TargetAliases;
}; };

View File

@ -16,7 +16,6 @@
#include "cmake.h" #include "cmake.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmTarget.h"
#include "cmGeneratorTarget.h" #include "cmGeneratorTarget.h"
#include "cmAlgorithms.h" #include "cmAlgorithms.h"
@ -116,7 +115,7 @@ cmGlobalUnixMakefileGenerator3
{ {
// Compute full path to object file directory for this target. // Compute full path to object file directory for this target.
std::string dir; std::string dir;
dir += gt->Makefile->GetCurrentBinaryDirectory(); dir += gt->LocalGenerator->GetCurrentBinaryDirectory();
dir += "/"; dir += "/";
dir += gt->LocalGenerator->GetTargetDirectory(gt); dir += gt->LocalGenerator->GetTargetDirectory(gt);
dir += "/"; dir += "/";
@ -423,17 +422,18 @@ void cmGlobalUnixMakefileGenerator3
{ {
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]); lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]);
// for all of out targets // for all of out targets
for (cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin(); std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
l != lg->GetMakefile()->GetTargets().end(); l++) for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++)
{ {
if((l->second.GetType() == cmState::EXECUTABLE) || if(((*l)->GetType() == cmState::EXECUTABLE) ||
(l->second.GetType() == cmState::STATIC_LIBRARY) || ((*l)->GetType() == cmState::STATIC_LIBRARY) ||
(l->second.GetType() == cmState::SHARED_LIBRARY) || ((*l)->GetType() == cmState::SHARED_LIBRARY) ||
(l->second.GetType() == cmState::MODULE_LIBRARY) || ((*l)->GetType() == cmState::MODULE_LIBRARY) ||
(l->second.GetType() == cmState::OBJECT_LIBRARY) || ((*l)->GetType() == cmState::OBJECT_LIBRARY) ||
(l->second.GetType() == cmState::UTILITY)) ((*l)->GetType() == cmState::UTILITY))
{ {
cmGeneratorTarget* gt = this->GetGeneratorTarget(&l->second); cmGeneratorTarget* gt = *l;
std::string tname = lg->GetRelativeTargetDirectory(gt); std::string tname = lg->GetRelativeTargetDirectory(gt);
tname += "/DependInfo.cmake"; tname += "/DependInfo.cmake";
cmSystemTools::ConvertToUnixSlashes(tname); cmSystemTools::ConvertToUnixSlashes(tname);
@ -460,11 +460,11 @@ cmGlobalUnixMakefileGenerator3
// The directory-level rule should depend on the target-level rules // The directory-level rule should depend on the target-level rules
// for all targets in the directory. // for all targets in the directory.
std::vector<std::string> depends; std::vector<std::string> depends;
cmGeneratorTargetsType targets = lg->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets();
for(cmGeneratorTargetsType::iterator l = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator l = targets.begin();
l != targets.end(); ++l) l != targets.end(); ++l)
{ {
cmGeneratorTarget* gtarget = l->second; cmGeneratorTarget* gtarget = *l;
int type = gtarget->GetType(); int type = gtarget->GetType();
if((type == cmState::EXECUTABLE) || if((type == cmState::EXECUTABLE) ||
(type == cmState::STATIC_LIBRARY) || (type == cmState::STATIC_LIBRARY) ||
@ -623,11 +623,11 @@ cmGlobalUnixMakefileGenerator3
lg = static_cast<cmLocalUnixMakefileGenerator3 *> lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->LocalGenerators[i]); (this->LocalGenerators[i]);
// for each target Generate the rule files for each target. // for each target Generate the rule files for each target.
cmGeneratorTargetsType targets = lg->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets();
for(cmGeneratorTargetsType::iterator t = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
cmGeneratorTarget* gtarget = t->second; cmGeneratorTarget* gtarget = *t;
// Don't emit the same rule twice (e.g. two targets with the same // Don't emit the same rule twice (e.g. two targets with the same
// simple name) // simple name)
int type = gtarget->GetType(); int type = gtarget->GetType();
@ -720,11 +720,11 @@ cmGlobalUnixMakefileGenerator3
depends.push_back("cmake_check_build_system"); depends.push_back("cmake_check_build_system");
// for each target Generate the rule files for each target. // for each target Generate the rule files for each target.
cmGeneratorTargetsType targets = lg->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets();
for(cmGeneratorTargetsType::iterator t = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
cmGeneratorTarget* gtarget = t->second; cmGeneratorTarget* gtarget = *t;
int type = gtarget->GetType(); int type = gtarget->GetType();
std::string name = gtarget->GetName(); std::string name = gtarget->GetName();
if (!name.empty() if (!name.empty()
@ -741,7 +741,7 @@ cmGlobalUnixMakefileGenerator3
makefileName = localName; makefileName = localName;
makefileName += "/build.make"; makefileName += "/build.make";
bool needRequiresStep = this->NeedRequiresStep(*gtarget->Target); bool needRequiresStep = this->NeedRequiresStep(gtarget);
lg->WriteDivider(ruleFileStream); lg->WriteDivider(ruleFileStream);
ruleFileStream ruleFileStream
@ -778,7 +778,7 @@ cmGlobalUnixMakefileGenerator3
std::ostringstream progressArg; std::ostringstream progressArg;
const char* sep = ""; const char* sep = "";
std::vector<unsigned long>& progFiles = std::vector<unsigned long>& progFiles =
this->ProgressMap[gtarget->Target].Marks; this->ProgressMap[gtarget].Marks;
for (std::vector<unsigned long>::iterator i = progFiles.begin(); for (std::vector<unsigned long>::iterator i = progFiles.begin();
i != progFiles.end(); ++i) i != progFiles.end(); ++i)
{ {
@ -914,13 +914,11 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
lgi != this->LocalGenerators.end(); ++lgi) lgi != this->LocalGenerators.end(); ++lgi)
{ {
cmLocalGenerator* lg = *lgi; cmLocalGenerator* lg = *lgi;
cmMakefile* mf = lg->GetMakefile(); std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets();
cmTargets const& targets = mf->GetTargets(); for(std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t) t != targets.end(); ++t)
{ {
cmTarget const& target = t->second; cmGeneratorTarget* gt = *t;
cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
cmLocalGenerator* tlg = gt->GetLocalGenerator(); cmLocalGenerator* tlg = gt->GetLocalGenerator();
@ -966,7 +964,7 @@ cmGlobalUnixMakefileGenerator3
size_t count = 0; size_t count = 0;
if(emitted.insert(target).second) if(emitted.insert(target).second)
{ {
count = this->ProgressMap[target->Target].Marks.size(); count = this->ProgressMap[target].Marks.size();
TargetDependSet const& depends = this->GetTargetDirectDepends(target); TargetDependSet const& depends = this->GetTargetDirectDepends(target);
for(TargetDependSet::const_iterator di = depends.begin(); for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) di != depends.end(); ++di)
@ -1003,7 +1001,7 @@ void
cmGlobalUnixMakefileGenerator3::RecordTargetProgress( cmGlobalUnixMakefileGenerator3::RecordTargetProgress(
cmMakefileTargetGenerator* tg) cmMakefileTargetGenerator* tg)
{ {
TargetProgress& tp = this->ProgressMap[tg->GetTarget()]; TargetProgress& tp = this->ProgressMap[tg->GetGeneratorTarget()];
tp.NumberOfActions = tg->GetNumberOfProgressActions(); tp.NumberOfActions = tg->GetNumberOfProgressActions();
tp.VariableFile = tg->GetProgressFileNameFull(); tp.VariableFile = tg->GetProgressFileNameFull();
} }
@ -1089,11 +1087,12 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
if (lg2 == lg || lg->GetMakefile()->IsRootMakefile()) if (lg2 == lg || lg->GetMakefile()->IsRootMakefile())
{ {
// for each target Generate the rule files for each target. // for each target Generate the rule files for each target.
cmTargets& targets = lg2->GetMakefile()->GetTargets(); std::vector<cmGeneratorTarget*> targets = lg2->GetGeneratorTargets();
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t)
{ {
cmTarget const& target = t->second; cmGeneratorTarget* target = *t;
cmState::TargetType type = target.GetType(); cmState::TargetType type = target->GetType();
if((type == cmState::EXECUTABLE) || if((type == cmState::EXECUTABLE) ||
(type == cmState::STATIC_LIBRARY) || (type == cmState::STATIC_LIBRARY) ||
(type == cmState::SHARED_LIBRARY) || (type == cmState::SHARED_LIBRARY) ||
@ -1102,7 +1101,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
(type == cmState::GLOBAL_TARGET) || (type == cmState::GLOBAL_TARGET) ||
(type == cmState::UTILITY)) (type == cmState::UTILITY))
{ {
std::string name = target.GetName(); std::string name = target->GetName();
if(emittedTargets.insert(name).second) if(emittedTargets.insert(name).second)
{ {
path = "... "; path = "... ";
@ -1129,19 +1128,19 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
bool cmGlobalUnixMakefileGenerator3 bool cmGlobalUnixMakefileGenerator3
::NeedRequiresStep(cmTarget const& target) ::NeedRequiresStep(const cmGeneratorTarget* target)
{ {
std::set<std::string> languages; std::set<std::string> languages;
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&target); target->GetLanguages(languages,
gtgt->GetLanguages(languages, target->Target->GetMakefile()
target.GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE")); ->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for(std::set<std::string>::const_iterator l = languages.begin(); for(std::set<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l) l != languages.end(); ++l)
{ {
std::string var = "CMAKE_NEEDS_REQUIRES_STEP_"; std::string var = "CMAKE_NEEDS_REQUIRES_STEP_";
var += *l; var += *l;
var += "_FLAG"; var += "_FLAG";
if(target.GetMakefile()->GetDefinition(var)) if(target->Target->GetMakefile()->GetDefinition(var))
{ {
return true; return true;
} }

View File

@ -154,7 +154,7 @@ protected:
cmGeneratorTarget* target); cmGeneratorTarget* target);
// does this generator need a requires step for any of its targets // does this generator need a requires step for any of its targets
bool NeedRequiresStep(cmTarget const&); bool NeedRequiresStep(cmGeneratorTarget const*);
// Target name hooks for superclass. // Target name hooks for superclass.
const char* GetAllTargetName() const { return "all"; } const char* GetAllTargetName() const { return "all"; }
@ -192,8 +192,8 @@ protected:
std::vector<unsigned long> Marks; std::vector<unsigned long> Marks;
void WriteProgressVariables(unsigned long total, unsigned long& current); void WriteProgressVariables(unsigned long total, unsigned long& current);
}; };
typedef std::map<cmTarget const*, TargetProgress, typedef std::map<cmGeneratorTarget const*, TargetProgress,
cmStrictTargetComparison> ProgressMapType; cmGeneratorTarget::StrictTargetComparison> ProgressMapType;
ProgressMapType ProgressMap; ProgressMapType ProgressMap;
size_t CountProgressMarksInTarget(cmGeneratorTarget const* target, size_t CountProgressMarksInTarget(cmGeneratorTarget const* target,

View File

@ -331,7 +331,7 @@ void cmGlobalVisualStudio10Generator::Generate()
this->cmGlobalVisualStudio8Generator::Generate(); this->cmGlobalVisualStudio8Generator::Generate();
if(this->LongestSource.Length > 0) if(this->LongestSource.Length > 0)
{ {
cmMakefile* mf = this->LongestSource.Target->GetMakefile(); cmLocalGenerator* lg = this->LongestSource.Target->GetLocalGenerator();
std::ostringstream e; std::ostringstream e;
e << e <<
"The binary and/or source directory paths may be too long to generate " "The binary and/or source directory paths may be too long to generate "
@ -346,13 +346,13 @@ void cmGlobalVisualStudio10Generator::Generate()
" " << this->LongestSource.SourceFile->GetFullPath() << "\n" " " << this->LongestSource.SourceFile->GetFullPath() << "\n"
"This is because some Visual Studio tools would append the relative " "This is because some Visual Studio tools would append the relative "
"path to the end of the referencing directory path, as in:\n" "path to the end of the referencing directory path, as in:\n"
" " << mf->GetCurrentBinaryDirectory() << "/" " " << lg->GetCurrentBinaryDirectory() << "/"
<< this->LongestSource.SourceRel << "\n" << this->LongestSource.SourceRel << "\n"
"and then incorrectly complain that the file does not exist because " "and then incorrectly complain that the file does not exist because "
"the path length is too long for some internal buffer or API. " "the path length is too long for some internal buffer or API. "
"To avoid this problem CMake must use a full path for this file " "To avoid this problem CMake must use a full path for this file "
"which then triggers the VS 10 property dialog bug."; "which then triggers the VS 10 property dialog bug.";
mf->IssueMessage(cmake::WARNING, e.str().c_str()); lg->IssueMessage(cmake::WARNING, e.str().c_str());
} }
} }
@ -591,9 +591,11 @@ cmGlobalVisualStudio10Generator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudio10Generator::PathTooLong( void cmGlobalVisualStudio10Generator::PathTooLong(
cmTarget* target, cmSourceFile const* sf, std::string const& sfRel) cmGeneratorTarget *target, cmSourceFile const* sf,
std::string const& sfRel)
{ {
size_t len = (strlen(target->GetMakefile()->GetCurrentBinaryDirectory()) + size_t len =
(strlen(target->GetLocalGenerator()->GetCurrentBinaryDirectory()) +
1 + sfRel.length()); 1 + sfRel.length());
if(len > this->LongestSource.Length) if(len > this->LongestSource.Length)
{ {

View File

@ -95,7 +95,7 @@ public:
/** Generate an <output>.rule file path for a given command output. */ /** Generate an <output>.rule file path for a given command output. */
virtual std::string GenerateRuleFile(std::string const& output) const; virtual std::string GenerateRuleFile(std::string const& output) const;
void PathTooLong(cmTarget* target, cmSourceFile const* sf, void PathTooLong(cmGeneratorTarget* target, cmSourceFile const* sf,
std::string const& sfRel); std::string const& sfRel);
virtual const char* GetToolsVersion() { return "4.0"; } virtual const char* GetToolsVersion() { return "4.0"; }
@ -139,7 +139,7 @@ private:
{ {
LongestSourcePath(): Length(0), Target(0), SourceFile(0) {} LongestSourcePath(): Length(0), Target(0), SourceFile(0) {}
size_t Length; size_t Length;
cmTarget* Target; cmGeneratorTarget* Target;
cmSourceFile const* SourceFile; cmSourceFile const* SourceFile;
std::string SourceRel; std::string SourceRel;
}; };

View File

@ -223,7 +223,7 @@ void cmGlobalVisualStudio6Generator
tt = orderedProjectTargets.begin(); tt = orderedProjectTargets.begin();
tt != orderedProjectTargets.end(); ++tt) tt != orderedProjectTargets.end(); ++tt)
{ {
cmTarget const* target = (*tt)->Target; cmGeneratorTarget const* target = *tt;
if(target->GetType() == cmState::INTERFACE_LIBRARY) if(target->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
@ -235,14 +235,15 @@ void cmGlobalVisualStudio6Generator
std::string project = target->GetName(); std::string project = target->GetName();
std::string location = expath; std::string location = expath;
this->WriteExternalProject(fout, project.c_str(), this->WriteExternalProject(fout, project.c_str(),
location.c_str(), target->GetUtilities()); location.c_str(), target->Target->GetUtilities());
} }
else else
{ {
std::string dspname = GetVS6TargetName(target->GetName()); std::string dspname = GetVS6TargetName(target->GetName());
std::string dir = target->GetMakefile()->GetCurrentBinaryDirectory(); std::string dir =
target->GetLocalGenerator()->GetCurrentBinaryDirectory();
dir = root->Convert(dir.c_str(), cmLocalGenerator::START_OUTPUT); dir = root->Convert(dir.c_str(), cmLocalGenerator::START_OUTPUT);
this->WriteProject(fout, dspname.c_str(), dir.c_str(), *target); this->WriteProject(fout, dspname.c_str(), dir.c_str(), target);
} }
} }
@ -287,9 +288,9 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile()
// Note, that dependencies from executables to // Note, that dependencies from executables to
// the libraries it uses are also done here // the libraries it uses are also done here
void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout, void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
const std::string& dspname, const std::string& dspname,
const char* dir, const char* dir,
cmTarget const& target) const cmGeneratorTarget *target)
{ {
fout << "#########################################################" fout << "#########################################################"
"######################\n\n"; "######################\n\n";
@ -298,7 +299,7 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
fout << "Package=<5>\n{{{\n}}}\n\n"; fout << "Package=<5>\n{{{\n}}}\n\n";
fout << "Package=<4>\n"; fout << "Package=<4>\n";
fout << "{{{\n"; fout << "{{{\n";
VSDependSet const& depends = this->VSTargetDepends[&target]; VSDependSet const& depends = this->VSTargetDepends[target];
for(VSDependSet::const_iterator di = depends.begin(); for(VSDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) di != depends.end(); ++di)
{ {
@ -309,7 +310,7 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
} }
fout << "}}}\n\n"; fout << "}}}\n\n";
UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target); UtilityDependsMap::iterator ui = this->UtilityDepends.find(target);
if(ui != this->UtilityDepends.end()) if(ui != this->UtilityDepends.end())
{ {
const char* uname = ui->second.c_str(); const char* uname = ui->second.c_str();
@ -382,12 +383,14 @@ void cmGlobalVisualStudio6Generator::WriteDSWHeader(std::ostream& fout)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmGlobalVisualStudio6Generator::WriteUtilityDepend(cmTarget const* target) cmGlobalVisualStudio6Generator::WriteUtilityDepend(
const cmGeneratorTarget *target)
{ {
std::string pname = target->GetName(); std::string pname = target->GetName();
pname += "_UTILITY"; pname += "_UTILITY";
pname = GetVS6TargetName(pname.c_str()); pname = GetVS6TargetName(pname.c_str());
std::string fname = target->GetMakefile()->GetCurrentBinaryDirectory(); std::string fname =
target->GetLocalGenerator()->GetCurrentBinaryDirectory();
fname += "/"; fname += "/";
fname += pname; fname += pname;
fname += ".dsp"; fname += ".dsp";

View File

@ -15,8 +15,6 @@
#include "cmGlobalVisualStudioGenerator.h" #include "cmGlobalVisualStudioGenerator.h"
#include "cmGlobalGeneratorFactory.h" #include "cmGlobalGeneratorFactory.h"
class cmTarget;
/** \class cmGlobalVisualStudio6Generator /** \class cmGlobalVisualStudio6Generator
* \brief Write a Unix makefiles. * \brief Write a Unix makefiles.
* *
@ -94,12 +92,12 @@ private:
void WriteDSWHeader(std::ostream& fout); void WriteDSWHeader(std::ostream& fout);
void WriteProject(std::ostream& fout, void WriteProject(std::ostream& fout,
const std::string& name, const char* path, const std::string& name, const char* path,
cmTarget const& t); cmGeneratorTarget const* t);
void WriteExternalProject(std::ostream& fout, void WriteExternalProject(std::ostream& fout,
const std::string& name, const char* path, const std::string& name, const char* path,
const std::set<std::string>& dependencies); const std::set<std::string>& dependencies);
void WriteDSWFooter(std::ostream& fout); void WriteDSWFooter(std::ostream& fout);
virtual std::string WriteUtilityDepend(cmTarget const* target); virtual std::string WriteUtilityDepend(const cmGeneratorTarget *target);
std::string MSDevCommand; std::string MSDevCommand;
bool MSDevCommandInitialized; bool MSDevCommandInitialized;
std::string const& GetMSDevCommand(); std::string const& GetMSDevCommand();

View File

@ -152,7 +152,7 @@ void
cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
const std::string& dspname, const std::string& dspname,
const char* dir, const char* dir,
cmTarget const& t) cmGeneratorTarget const* t)
{ {
// check to see if this is a fortran build // check to see if this is a fortran build
const char* ext = ".vcproj"; const char* ext = ".vcproj";
@ -163,7 +163,7 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
ext = ".vfproj"; ext = ".vfproj";
project = "Project(\"{6989167D-11E4-40FE-8C1A-2192A86A7E90}\") = \""; project = "Project(\"{6989167D-11E4-40FE-8C1A-2192A86A7E90}\") = \"";
} }
const char* targetExt = t.GetProperty("GENERATOR_FILE_NAME_EXT"); const char* targetExt = t->GetProperty("GENERATOR_FILE_NAME_EXT");
if(targetExt) if(targetExt)
{ {
ext = targetExt; ext = targetExt;
@ -180,7 +180,7 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
fout <<"EndProject\n"; fout <<"EndProject\n";
UtilityDependsMap::iterator ui = this->UtilityDepends.find(&t); UtilityDependsMap::iterator ui = this->UtilityDepends.find(t);
if(ui != this->UtilityDepends.end()) if(ui != this->UtilityDepends.end())
{ {
const char* uname = ui->second.c_str(); const char* uname = ui->second.c_str();
@ -204,9 +204,9 @@ void
cmGlobalVisualStudio71Generator cmGlobalVisualStudio71Generator
::WriteProjectDepends(std::ostream& fout, ::WriteProjectDepends(std::ostream& fout,
const std::string&, const std::string&,
const char*, cmTarget const& target) const char*, cmGeneratorTarget const* target)
{ {
VSDependSet const& depends = this->VSTargetDepends[&target]; VSDependSet const& depends = this->VSTargetDepends[target];
for(VSDependSet::const_iterator di = depends.begin(); for(VSDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) di != depends.end(); ++di)
{ {
@ -215,7 +215,7 @@ cmGlobalVisualStudio71Generator
if(guid.empty()) if(guid.empty())
{ {
std::string m = "Target: "; std::string m = "Target: ";
m += target.GetName(); m += target->GetName();
m += " depends on unknown target: "; m += " depends on unknown target: ";
m += name; m += name;
cmSystemTools::Error(m.c_str()); cmSystemTools::Error(m.c_str());

View File

@ -59,10 +59,10 @@ protected:
std::ostream& fout, std::vector<std::string> const& configs); std::ostream& fout, std::vector<std::string> const& configs);
virtual void WriteProject(std::ostream& fout, virtual void WriteProject(std::ostream& fout,
const std::string& name, const char* path, const std::string& name, const char* path,
cmTarget const& t); const cmGeneratorTarget *t);
virtual void WriteProjectDepends(std::ostream& fout, virtual void WriteProjectDepends(std::ostream& fout,
const std::string& name, const char* path, const std::string& name, const char* path,
cmTarget const& t); cmGeneratorTarget const* t);
virtual void WriteProjectConfigurations( virtual void WriteProjectConfigurations(
std::ostream& fout, const std::string& name, cmState::TargetType type, std::ostream& fout, const std::string& name, cmState::TargetType type,
std::vector<std::string> const& configs, std::vector<std::string> const& configs,

View File

@ -441,7 +441,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
for(OrderedTargetDependSet::const_iterator tt = for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt) projectTargets.begin(); tt != projectTargets.end(); ++tt)
{ {
cmTarget const* target = (*tt)->Target; cmGeneratorTarget const* target = *tt;
if(target->GetType() == cmState::INTERFACE_LIBRARY) if(target->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
@ -459,7 +459,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
project.c_str(), project.c_str(),
location.c_str(), location.c_str(),
target->GetProperty("VS_PROJECT_TYPE"), target->GetProperty("VS_PROJECT_TYPE"),
target->GetUtilities()); target->Target->GetUtilities());
written = true; written = true;
} }
else else
@ -468,9 +468,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
target->GetProperty("GENERATOR_FILE_NAME"); target->GetProperty("GENERATOR_FILE_NAME");
if(vcprojName) if(vcprojName)
{ {
cmLocalGenerator* lg = cmLocalGenerator* lg = target->GetLocalGenerator();
root->GetGlobalGenerator()->GetGeneratorTarget(target)
->GetLocalGenerator();
std::string dir = lg->GetCurrentBinaryDirectory(); std::string dir = lg->GetCurrentBinaryDirectory();
dir = root->Convert(dir.c_str(), dir = root->Convert(dir.c_str(),
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
@ -479,7 +477,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
dir = ""; // msbuild cannot handle ".\" prefix dir = ""; // msbuild cannot handle ".\" prefix
} }
this->WriteProject(fout, vcprojName, dir.c_str(), this->WriteProject(fout, vcprojName, dir.c_str(),
*target); target);
written = true; written = true;
} }
} }
@ -535,19 +533,19 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends(
for(OrderedTargetDependSet::const_iterator tt = for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt) projectTargets.begin(); tt != projectTargets.end(); ++tt)
{ {
cmTarget const* target = (*tt)->Target; cmGeneratorTarget const* target = *tt;
if(target->GetType() == cmState::INTERFACE_LIBRARY) if(target->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
cmMakefile* mf = target->GetMakefile();
const char *vcprojName = const char *vcprojName =
target->GetProperty("GENERATOR_FILE_NAME"); target->GetProperty("GENERATOR_FILE_NAME");
if (vcprojName) if (vcprojName)
{ {
std::string dir = mf->GetCurrentSourceDirectory(); std::string dir = target->GetLocalGenerator()
->GetCurrentSourceDirectory();
this->WriteProjectDepends(fout, vcprojName, this->WriteProjectDepends(fout, vcprojName,
dir.c_str(), *target); dir.c_str(), target);
} }
} }
} }
@ -687,7 +685,8 @@ cmGlobalVisualStudio7Generator::ConvertToSolutionPath(const char* path)
// the libraries it uses are also done here // the libraries it uses are also done here
void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout, void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
const std::string& dspname, const std::string& dspname,
const char* dir, cmTarget const& target) const char* dir,
cmGeneratorTarget const* target)
{ {
// check to see if this is a fortran build // check to see if this is a fortran build
const char* ext = ".vcproj"; const char* ext = ".vcproj";
@ -705,7 +704,7 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
<< dspname << ext << "\", \"{" << dspname << ext << "\", \"{"
<< this->GetGUID(dspname) << "}\"\nEndProject\n"; << this->GetGUID(dspname) << "}\"\nEndProject\n";
UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target); UtilityDependsMap::iterator ui = this->UtilityDepends.find(target);
if(ui != this->UtilityDepends.end()) if(ui != this->UtilityDepends.end())
{ {
const char* uname = ui->second.c_str(); const char* uname = ui->second.c_str();
@ -727,11 +726,11 @@ void
cmGlobalVisualStudio7Generator cmGlobalVisualStudio7Generator
::WriteProjectDepends(std::ostream& fout, ::WriteProjectDepends(std::ostream& fout,
const std::string& dspname, const std::string& dspname,
const char*, cmTarget const& target) const char*, cmGeneratorTarget const* target)
{ {
int depcount = 0; int depcount = 0;
std::string dspguid = this->GetGUID(dspname); std::string dspguid = this->GetGUID(dspname);
VSDependSet const& depends = this->VSTargetDepends[&target]; VSDependSet const& depends = this->VSTargetDepends[target];
for(VSDependSet::const_iterator di = depends.begin(); for(VSDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) di != depends.end(); ++di)
{ {
@ -740,7 +739,7 @@ cmGlobalVisualStudio7Generator
if(guid.empty()) if(guid.empty())
{ {
std::string m = "Target: "; std::string m = "Target: ";
m += target.GetName(); m += target->GetName();
m += " depends on unknown target: "; m += " depends on unknown target: ";
m += name; m += name;
cmSystemTools::Error(m.c_str()); cmSystemTools::Error(m.c_str());
@ -749,7 +748,7 @@ cmGlobalVisualStudio7Generator
depcount++; depcount++;
} }
UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target); UtilityDependsMap::iterator ui = this->UtilityDepends.find(target);
if(ui != this->UtilityDepends.end()) if(ui != this->UtilityDepends.end())
{ {
const char* uname = ui->second.c_str(); const char* uname = ui->second.c_str();
@ -889,13 +888,14 @@ void cmGlobalVisualStudio7Generator::WriteSLNHeader(std::ostream& fout)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target) cmGlobalVisualStudio7Generator::WriteUtilityDepend(
cmGeneratorTarget const* target)
{ {
std::vector<std::string> configs; std::vector<std::string> configs;
target->GetMakefile()->GetConfigurations(configs); target->Target->GetMakefile()->GetConfigurations(configs);
std::string pname = target->GetName(); std::string pname = target->GetName();
pname += "_UTILITY"; pname += "_UTILITY";
std::string fname = target->GetMakefile()->GetCurrentBinaryDirectory(); std::string fname = target->GetLocalGenerator()->GetCurrentBinaryDirectory();
fname += "/"; fname += "/";
fname += pname; fname += pname;
fname += ".vcproj"; fname += ".vcproj";

View File

@ -94,7 +94,8 @@ public:
/** Return true if the target project file should have the option /** Return true if the target project file should have the option
LinkLibraryDependencies and link to .sln dependencies. */ LinkLibraryDependencies and link to .sln dependencies. */
virtual bool NeedLinkLibraryDependencies(cmTarget&) { return false; } virtual bool NeedLinkLibraryDependencies(cmGeneratorTarget*)
{ return false; }
const char* GetIntelProjectVersion(); const char* GetIntelProjectVersion();
@ -123,10 +124,10 @@ protected:
std::vector<cmLocalGenerator*>& generators); std::vector<cmLocalGenerator*>& generators);
virtual void WriteProject(std::ostream& fout, virtual void WriteProject(std::ostream& fout,
const std::string& name, const char* path, const std::string& name, const char* path,
cmTarget const& t); const cmGeneratorTarget *t);
virtual void WriteProjectDepends(std::ostream& fout, virtual void WriteProjectDepends(std::ostream& fout,
const std::string& name, const char* path, const std::string& name, const char* path,
cmTarget const&t); cmGeneratorTarget const* t);
virtual void WriteProjectConfigurations( virtual void WriteProjectConfigurations(
std::ostream& fout, const std::string& name, cmState::TargetType type, std::ostream& fout, const std::string& name, cmState::TargetType type,
std::vector<std::string> const& configs, std::vector<std::string> const& configs,
@ -136,7 +137,7 @@ protected:
cmLocalGenerator* root); cmLocalGenerator* root);
virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNFooter(std::ostream& fout);
virtual void WriteSLNHeader(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout);
virtual std::string WriteUtilityDepend(cmTarget const* target); virtual std::string WriteUtilityDepend(const cmGeneratorTarget *target);
virtual void WriteTargetsToSolution( virtual void WriteTargetsToSolution(
std::ostream& fout, std::ostream& fout,

View File

@ -256,7 +256,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
noCommandLines); noCommandLines);
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg); cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
lg->AddGeneratorTarget(tgt, gt); lg->AddGeneratorTarget(gt);
this->AddGeneratorTarget(tgt, gt); this->AddGeneratorTarget(tgt, gt);
// Organize in the "predefined targets" folder: // Organize in the "predefined targets" folder:
@ -441,9 +441,9 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudio8Generator::WriteProjectDepends( void cmGlobalVisualStudio8Generator::WriteProjectDepends(
std::ostream& fout, const std::string&, const char*, cmTarget const& t) std::ostream& fout, const std::string&, const char*,
cmGeneratorTarget const* gt)
{ {
cmGeneratorTarget* gt = this->GetGeneratorTarget(&t);
TargetDependSet const& unordered = this->GetTargetDirectDepends(gt); TargetDependSet const& unordered = this->GetTargetDirectDepends(gt);
OrderedTargetDependSet depends(unordered, std::string()); OrderedTargetDependSet depends(unordered, std::string());
for(OrderedTargetDependSet::const_iterator i = depends.begin(); for(OrderedTargetDependSet::const_iterator i = depends.begin();
@ -460,14 +460,15 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies( bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
cmTarget& target) cmGeneratorTarget *target)
{ {
// Look for utility dependencies that magically link. // Look for utility dependencies that magically link.
for(std::set<std::string>::const_iterator ui = for(std::set<std::string>::const_iterator ui =
target.GetUtilities().begin(); target->Target->GetUtilities().begin();
ui != target.GetUtilities().end(); ++ui) ui != target->Target->GetUtilities().end(); ++ui)
{ {
if(cmTarget* depTarget = this->FindTarget(ui->c_str())) if(cmGeneratorTarget* depTarget =
target->GetLocalGenerator()->FindGeneratorTargetToUse(ui->c_str()))
{ {
if(depTarget->GetType() != cmState::INTERFACE_LIBRARY if(depTarget->GetType() != cmState::INTERFACE_LIBRARY
&& depTarget->GetProperty("EXTERNAL_MSPROJECT")) && depTarget->GetProperty("EXTERNAL_MSPROJECT"))

View File

@ -60,7 +60,7 @@ public:
/** Return true if the target project file should have the option /** Return true if the target project file should have the option
LinkLibraryDependencies and link to .sln dependencies. */ LinkLibraryDependencies and link to .sln dependencies. */
virtual bool NeedLinkLibraryDependencies(cmTarget& target); virtual bool NeedLinkLibraryDependencies(cmGeneratorTarget* target);
/** Return true if building for Windows CE */ /** Return true if building for Windows CE */
virtual bool TargetsWindowsCE() const { virtual bool TargetsWindowsCE() const {
@ -91,7 +91,8 @@ protected:
virtual bool ComputeTargetDepends(); virtual bool ComputeTargetDepends();
virtual void WriteProjectDepends(std::ostream& fout, virtual void WriteProjectDepends(std::ostream& fout,
const std::string& name, const std::string& name,
const char* path, cmTarget const& t); const char* path,
const cmGeneratorTarget *t);
std::string Name; std::string Name;
std::string WindowsCEVersion; std::string WindowsCEVersion;

View File

@ -87,7 +87,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
"Build all projects"); "Build all projects");
cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]); cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
gen[0]->AddGeneratorTarget(allBuild, gt); gen[0]->AddGeneratorTarget(gt);
this->AddGeneratorTarget(allBuild, gt); this->AddGeneratorTarget(allBuild, gt);
#if 0 #if 0
@ -108,19 +108,20 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
for(std::vector<cmLocalGenerator*>::iterator i = gen.begin(); for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
i != gen.end(); ++i) i != gen.end(); ++i)
{ {
cmGeneratorTargetsType targets = std::vector<cmGeneratorTarget*> targets =
(*i)->GetGeneratorTargets(); (*i)->GetGeneratorTargets();
for(cmGeneratorTargetsType::iterator t = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
if (t->second->GetType() == cmState::GLOBAL_TARGET cmGeneratorTarget* tgt = *t;
|| t->first->IsImported()) if (tgt->GetType() == cmState::GLOBAL_TARGET
|| tgt->IsImported())
{ {
continue; continue;
} }
if(!this->IsExcluded(gen[0], t->second)) if(!this->IsExcluded(gen[0], tgt))
{ {
allBuild->AddUtility(t->second->GetName()); allBuild->AddUtility(tgt->GetName());
} }
} }
} }
@ -302,19 +303,20 @@ std::string cmGlobalVisualStudioGenerator::GetUserMacrosRegKeyBase()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget const* target, void cmGlobalVisualStudioGenerator::FillLinkClosure(
TargetSet& linked) const cmGeneratorTarget *target,
TargetSet& linked)
{ {
if(linked.insert(target).second) if(linked.insert(target).second)
{ {
cmGeneratorTarget* gt = this->GetGeneratorTarget(target); TargetDependSet const& depends =
TargetDependSet const& depends = this->GetTargetDirectDepends(gt); this->GetTargetDirectDepends(target);
for(TargetDependSet::const_iterator di = depends.begin(); for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) di != depends.end(); ++di)
{ {
if(di->IsLink()) if(di->IsLink())
{ {
this->FillLinkClosure((*di)->Target, linked); this->FillLinkClosure(*di, linked);
} }
} }
} }
@ -322,7 +324,7 @@ void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget const* target,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudioGenerator::TargetSet const& cmGlobalVisualStudioGenerator::TargetSet const&
cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmTarget* target) cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmGeneratorTarget* target)
{ {
TargetSetMap::iterator i = this->TargetLinkClosure.find(target); TargetSetMap::iterator i = this->TargetLinkClosure.find(target);
if(i == this->TargetLinkClosure.end()) if(i == this->TargetLinkClosure.end())
@ -336,7 +338,8 @@ cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmTarget* target)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudioGenerator::FollowLinkDepends( void cmGlobalVisualStudioGenerator::FollowLinkDepends(
cmTarget const* target, std::set<cmTarget const*>& linked) const cmGeneratorTarget *target,
std::set<const cmGeneratorTarget *> &linked)
{ {
if(target->GetType() == cmState::INTERFACE_LIBRARY) if(target->GetType() == cmState::INTERFACE_LIBRARY)
{ {
@ -347,14 +350,13 @@ void cmGlobalVisualStudioGenerator::FollowLinkDepends(
{ {
// Static library targets do not list their link dependencies so // Static library targets do not list their link dependencies so
// we must follow them transitively now. // we must follow them transitively now.
cmGeneratorTarget* gt = this->GetGeneratorTarget(target); TargetDependSet const& depends = this->GetTargetDirectDepends(target);
TargetDependSet const& depends = this->GetTargetDirectDepends(gt);
for(TargetDependSet::const_iterator di = depends.begin(); for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) di != depends.end(); ++di)
{ {
if(di->IsLink()) if(di->IsLink())
{ {
this->FollowLinkDepends((*di)->Target, linked); this->FollowLinkDepends(*di, linked);
} }
} }
} }
@ -374,11 +376,11 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
for(std::vector<cmLocalGenerator*>::iterator i = gen.begin(); for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
i != gen.end(); ++i) i != gen.end(); ++i)
{ {
cmTargets& targets = (*i)->GetMakefile()->GetTargets(); std::vector<cmGeneratorTarget*> targets = (*i)->GetGeneratorTargets();
for(cmTargets::iterator ti = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ++ti) ti != targets.end(); ++ti)
{ {
this->ComputeVSTargetDepends(ti->second); this->ComputeVSTargetDepends(*ti);
} }
} }
} }
@ -392,13 +394,14 @@ static bool VSLinkable(cmGeneratorTarget const* t)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(
cmGeneratorTarget* target)
{ {
if(this->VSTargetDepends.find(&target) != this->VSTargetDepends.end()) if(this->VSTargetDepends.find(target) != this->VSTargetDepends.end())
{ {
return; return;
} }
VSDependSet& vsTargetDepend = this->VSTargetDepends[&target]; VSDependSet& vsTargetDepend = this->VSTargetDepends[target];
// VS <= 7.1 has two behaviors that affect solution dependencies. // VS <= 7.1 has two behaviors that affect solution dependencies.
// //
// (1) Solution-level dependencies between a linkable target and a // (1) Solution-level dependencies between a linkable target and a
@ -418,19 +421,18 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
// leaving them out for the static library itself but following them // leaving them out for the static library itself but following them
// transitively for other targets. // transitively for other targets.
bool allowLinkable = (target.GetType() != cmState::STATIC_LIBRARY && bool allowLinkable = (target->GetType() != cmState::STATIC_LIBRARY &&
target.GetType() != cmState::SHARED_LIBRARY && target->GetType() != cmState::SHARED_LIBRARY &&
target.GetType() != cmState::MODULE_LIBRARY && target->GetType() != cmState::MODULE_LIBRARY &&
target.GetType() != cmState::EXECUTABLE); target->GetType() != cmState::EXECUTABLE);
cmGeneratorTarget* gt = this->GetGeneratorTarget(&target); TargetDependSet const& depends = this->GetTargetDirectDepends(target);
TargetDependSet const& depends = this->GetTargetDirectDepends(gt);
// Collect implicit link dependencies (target_link_libraries). // Collect implicit link dependencies (target_link_libraries).
// Static libraries cannot depend on their link implementation // Static libraries cannot depend on their link implementation
// due to behavior (2), but they do not really need to. // due to behavior (2), but they do not really need to.
std::set<cmTarget const*> linkDepends; std::set<cmGeneratorTarget const*> linkDepends;
if(target.GetType() != cmState::STATIC_LIBRARY) if(target->GetType() != cmState::STATIC_LIBRARY)
{ {
for(TargetDependSet::const_iterator di = depends.begin(); for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) di != depends.end(); ++di)
@ -438,55 +440,54 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
cmTargetDepend dep = *di; cmTargetDepend dep = *di;
if(dep.IsLink()) if(dep.IsLink())
{ {
this->FollowLinkDepends(dep->Target, linkDepends); this->FollowLinkDepends(*di, linkDepends);
} }
} }
} }
// Collect explicit util dependencies (add_dependencies). // Collect explicit util dependencies (add_dependencies).
std::set<cmTarget const*> utilDepends; std::set<cmGeneratorTarget const*> utilDepends;
for(TargetDependSet::const_iterator di = depends.begin(); for(TargetDependSet::const_iterator di = depends.begin();
di != depends.end(); ++di) di != depends.end(); ++di)
{ {
cmTargetDepend dep = *di; cmTargetDepend dep = *di;
if(dep.IsUtil()) if(dep.IsUtil())
{ {
this->FollowLinkDepends(dep->Target, utilDepends); this->FollowLinkDepends(*di, utilDepends);
} }
} }
// Collect all targets linked by this target so we can avoid // Collect all targets linked by this target so we can avoid
// intermediate targets below. // intermediate targets below.
TargetSet linked; TargetSet linked;
if(target.GetType() != cmState::STATIC_LIBRARY) if(target->GetType() != cmState::STATIC_LIBRARY)
{ {
linked = this->GetTargetLinkClosure(&target); linked = this->GetTargetLinkClosure(target);
} }
// Emit link dependencies. // Emit link dependencies.
for(std::set<cmTarget const*>::iterator di = linkDepends.begin(); for(std::set<cmGeneratorTarget const*>::iterator di = linkDepends.begin();
di != linkDepends.end(); ++di) di != linkDepends.end(); ++di)
{ {
cmTarget const* dep = *di; cmGeneratorTarget const* dep = *di;
vsTargetDepend.insert(dep->GetName()); vsTargetDepend.insert(dep->GetName());
} }
// Emit util dependencies. Possibly use intermediate targets. // Emit util dependencies. Possibly use intermediate targets.
for(std::set<cmTarget const*>::iterator di = utilDepends.begin(); for(std::set<cmGeneratorTarget const*>::iterator di = utilDepends.begin();
di != utilDepends.end(); ++di) di != utilDepends.end(); ++di)
{ {
cmTarget const* dep = *di; cmGeneratorTarget const* dgt = *di;
cmGeneratorTarget* dgt = this->GetGeneratorTarget(dep); if(allowLinkable || !VSLinkable(dgt) || linked.count(dgt))
if(allowLinkable || !VSLinkable(dgt) || linked.count(dep))
{ {
// Direct dependency allowed. // Direct dependency allowed.
vsTargetDepend.insert(dep->GetName()); vsTargetDepend.insert(dgt->GetName());
} }
else else
{ {
// Direct dependency on linkable target not allowed. // Direct dependency on linkable target not allowed.
// Use an intermediate utility target. // Use an intermediate utility target.
vsTargetDepend.insert(this->GetUtilityDepend(dep)); vsTargetDepend.insert(this->GetUtilityDepend(dgt));
} }
} }
} }
@ -506,7 +507,8 @@ void cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget const* target) cmGlobalVisualStudioGenerator::GetUtilityDepend(
cmGeneratorTarget const* target)
{ {
UtilityDependsMap::iterator i = this->UtilityDepends.find(target); UtilityDependsMap::iterator i = this->UtilityDepends.find(target);
if(i == this->UtilityDepends.end()) if(i == this->UtilityDepends.end())
@ -829,10 +831,8 @@ void RegisterVisualStudioMacros(const std::string& macrosFile,
} }
} }
bool bool
cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmTarget const& target) cmGlobalVisualStudioGenerator::TargetIsFortranOnly(cmGeneratorTarget const* gt)
{ {
cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
// check to see if this is a fortran build // check to see if this is a fortran build
std::set<std::string> languages; std::set<std::string> languages;
{ {
@ -891,9 +891,7 @@ cmGlobalVisualStudioGenerator::OrderedTargetDependSet
for (TargetSet::const_iterator it = targets.begin(); for (TargetSet::const_iterator it = targets.begin();
it != targets.end(); ++it) it != targets.end(); ++it)
{ {
cmGeneratorTarget* gt = this->insert(*it);
(*it)->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(*it);
this->insert(gt);
} }
} }

View File

@ -73,7 +73,7 @@ public:
const char* vsSolutionFile = 0); const char* vsSolutionFile = 0);
// return true if target is fortran only // return true if target is fortran only
bool TargetIsFortranOnly(cmTarget const& t); bool TargetIsFortranOnly(const cmGeneratorTarget *gt);
/** Get the top-level registry key for this VS version. */ /** Get the top-level registry key for this VS version. */
std::string GetRegistryBase(); std::string GetRegistryBase();
@ -88,7 +88,7 @@ public:
/** Return true if building for Windows CE */ /** Return true if building for Windows CE */
virtual bool TargetsWindowsCE() const { return false; } virtual bool TargetsWindowsCE() const { return false; }
class TargetSet: public std::set<cmTarget const*> {}; class TargetSet: public std::set<cmGeneratorTarget const*> {};
class TargetCompare class TargetCompare
{ {
std::string First; std::string First;
@ -122,15 +122,16 @@ protected:
virtual bool ComputeTargetDepends(); virtual bool ComputeTargetDepends();
class VSDependSet: public std::set<std::string> {}; class VSDependSet: public std::set<std::string> {};
class VSDependMap: public std::map<cmTarget const*, VSDependSet> {}; class VSDependMap: public std::map<cmGeneratorTarget const*, VSDependSet> {};
VSDependMap VSTargetDepends; VSDependMap VSTargetDepends;
void ComputeVSTargetDepends(cmTarget&); void ComputeVSTargetDepends(cmGeneratorTarget *);
bool CheckTargetLinks(cmTarget& target, const std::string& name); bool CheckTargetLinks(cmGeneratorTarget& target, const std::string& name);
std::string GetUtilityForTarget(cmTarget& target, const std::string&); std::string GetUtilityForTarget(cmGeneratorTarget& target,
virtual std::string WriteUtilityDepend(cmTarget const*) = 0; const std::string&);
std::string GetUtilityDepend(cmTarget const* target); virtual std::string WriteUtilityDepend(cmGeneratorTarget const*) = 0;
typedef std::map<cmTarget const*, std::string> UtilityDependsMap; std::string GetUtilityDepend(const cmGeneratorTarget *target);
typedef std::map<cmGeneratorTarget const*, std::string> UtilityDependsMap;
UtilityDependsMap UtilityDepends; UtilityDependsMap UtilityDepends;
protected: protected:
@ -141,13 +142,14 @@ private:
void PrintCompilerAdvice(std::ostream&, std::string const&, void PrintCompilerAdvice(std::ostream&, std::string const&,
const char*) const {} const char*) const {}
void FollowLinkDepends(cmTarget const* target, void FollowLinkDepends(cmGeneratorTarget const* target,
std::set<cmTarget const*>& linked); std::set<cmGeneratorTarget const*>& linked);
class TargetSetMap: public std::map<cmTarget*, TargetSet> {}; class TargetSetMap: public std::map<cmGeneratorTarget*, TargetSet> {};
TargetSetMap TargetLinkClosure; TargetSetMap TargetLinkClosure;
void FillLinkClosure(cmTarget const* target, TargetSet& linked); void FillLinkClosure(const cmGeneratorTarget *target,
TargetSet const& GetTargetLinkClosure(cmTarget* target); TargetSet& linked);
TargetSet const& GetTargetLinkClosure(cmGeneratorTarget* target);
}; };
class cmGlobalVisualStudioGenerator::OrderedTargetDependSet: class cmGlobalVisualStudioGenerator::OrderedTargetDependSet:

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,6 @@
#include "cmXCodeObject.h" #include "cmXCodeObject.h"
#include "cmCustomCommand.h" #include "cmCustomCommand.h"
class cmGlobalGeneratorFactory; class cmGlobalGeneratorFactory;
class cmTarget;
class cmSourceFile; class cmSourceFile;
class cmSourceGroup; class cmSourceGroup;
@ -90,7 +89,7 @@ protected:
virtual void AddExtraIDETargets(); virtual void AddExtraIDETargets();
virtual void Generate(); virtual void Generate();
private: private:
cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget, cmXCodeObject* CreateOrGetPBXGroup(cmGeneratorTarget* gtgt,
cmSourceGroup* sg); cmSourceGroup* sg);
cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent, cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent,
std::string name); std::string name);
@ -108,22 +107,22 @@ private:
cmXCodeObject* resourceBuildPhase, cmXCodeObject* resourceBuildPhase,
std::vector<cmXCodeObject*> contentBuildPhases, std::vector<cmXCodeObject*> contentBuildPhases,
cmXCodeObject* frameworkBuildPhase, cmXCodeObject* frameworkBuildPhase,
cmTarget& cmtarget); cmGeneratorTarget *gtgt);
std::string ComputeInfoPListLocation(cmTarget& target); std::string ComputeInfoPListLocation(cmGeneratorTarget *target);
void AddCommandsToBuildPhase(cmXCodeObject* buildphase, void AddCommandsToBuildPhase(cmXCodeObject* buildphase,
cmTarget& target, cmGeneratorTarget *target,
std::vector<cmCustomCommand> std::vector<cmCustomCommand>
const & commands, const & commands,
const char* commandFileName); const char* commandFileName);
void CreateCustomRulesMakefile(const char* makefileBasename, void CreateCustomRulesMakefile(const char* makefileBasename,
cmTarget& target, cmGeneratorTarget* target,
std::vector<cmCustomCommand> const & commands, std::vector<cmCustomCommand> const & commands,
const std::string& configName); const std::string& configName);
cmXCodeObject* FindXCodeTarget(cmTarget const*); cmXCodeObject* FindXCodeTarget(const cmGeneratorTarget *);
std::string GetOrCreateId(const std::string& name, const std::string& id); std::string GetOrCreateId(const std::string& name, const std::string& id);
// create cmXCodeObject from these functions so that memory can be managed // create cmXCodeObject from these functions so that memory can be managed
@ -132,22 +131,23 @@ private:
cmXCodeObject* CreateObject(cmXCodeObject::Type type); cmXCodeObject* CreateObject(cmXCodeObject::Type type);
cmXCodeObject* CreateString(const std::string& s); cmXCodeObject* CreateString(const std::string& s);
cmXCodeObject* CreateObjectReference(cmXCodeObject*); cmXCodeObject* CreateObjectReference(cmXCodeObject*);
cmXCodeObject* CreateXCodeTarget(cmTarget& target, cmXCodeObject* CreateXCodeTarget(cmGeneratorTarget *gtgt,
cmXCodeObject* buildPhases); cmXCodeObject* buildPhases);
void ForceLinkerLanguages(); void ForceLinkerLanguages();
void ForceLinkerLanguage(cmTarget& cmtarget); void ForceLinkerLanguage(cmGeneratorTarget* gtgt);
const char* GetTargetLinkFlagsVar(cmTarget const& cmtarget) const; const char* GetTargetLinkFlagsVar(const cmGeneratorTarget *target) const;
const char* GetTargetFileType(cmGeneratorTarget* target); const char* GetTargetFileType(cmGeneratorTarget* target);
const char* GetTargetProductType(cmGeneratorTarget* target); const char* GetTargetProductType(cmGeneratorTarget* target);
std::string AddConfigurations(cmXCodeObject* target, cmTarget& cmtarget); std::string AddConfigurations(cmXCodeObject* target,
cmGeneratorTarget *gtgt);
void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr, void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr,
const char* value); const char* value);
void AppendBuildSettingAttribute(cmXCodeObject* target, const char* attr, void AppendBuildSettingAttribute(cmXCodeObject* target, const char* attr,
const char* value, const char* value,
const std::string& configName); const std::string& configName);
cmXCodeObject* CreateUtilityTarget(cmTarget& target); cmXCodeObject* CreateUtilityTarget(cmGeneratorTarget *gtgt);
void AddDependAndLinkInformation(cmXCodeObject* target); void AddDependAndLinkInformation(cmXCodeObject* target);
void CreateBuildSettings(cmTarget& target, void CreateBuildSettings(cmGeneratorTarget *gtgt,
cmXCodeObject* buildSettings, cmXCodeObject* buildSettings,
const std::string& buildType); const std::string& buildType);
std::string ExtractFlag(const char* flag, std::string& flags); std::string ExtractFlag(const char* flag, std::string& flags);
@ -163,18 +163,18 @@ private:
void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root, void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators); std::vector<cmLocalGenerator*>& generators);
cmXCodeObject* CreateXCodeFileReferenceFromPath(const std::string &fullpath, cmXCodeObject* CreateXCodeFileReferenceFromPath(const std::string &fullpath,
cmTarget& cmtarget, cmGeneratorTarget *target,
const std::string &lang, const std::string &lang,
cmSourceFile* sf); cmSourceFile* sf);
cmXCodeObject* CreateXCodeSourceFileFromPath(const std::string &fullpath, cmXCodeObject* CreateXCodeSourceFileFromPath(const std::string &fullpath,
cmTarget& cmtarget, cmGeneratorTarget *target,
const std::string &lang, const std::string &lang,
cmSourceFile* sf); cmSourceFile* sf);
cmXCodeObject* CreateXCodeFileReference(cmSourceFile* sf, cmXCodeObject* CreateXCodeFileReference(cmSourceFile* sf,
cmTarget& cmtarget); cmGeneratorTarget *target);
cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen, cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen,
cmSourceFile* sf, cmSourceFile* sf,
cmTarget& cmtarget); cmGeneratorTarget *gtgt);
bool CreateXCodeTargets(cmLocalGenerator* gen, bool CreateXCodeTargets(cmLocalGenerator* gen,
std::vector<cmXCodeObject*>&); std::vector<cmXCodeObject*>&);
bool IsHeaderFile(cmSourceFile*); bool IsHeaderFile(cmSourceFile*);
@ -187,7 +187,7 @@ private:
std::vector<cmLocalGenerator*>& gens); std::vector<cmLocalGenerator*>& gens);
cmXCodeObject* CreateBuildPhase(const char* name, cmXCodeObject* CreateBuildPhase(const char* name,
const char* name2, const char* name2,
cmTarget& cmtarget, cmGeneratorTarget *target,
const std::vector<cmCustomCommand>&); const std::vector<cmCustomCommand>&);
void CreateReRunCMakeFile(cmLocalGenerator* root, void CreateReRunCMakeFile(cmLocalGenerator* root,
std::vector<cmLocalGenerator*> const& gens); std::vector<cmLocalGenerator*> const& gens);
@ -226,10 +226,9 @@ private:
void PrintCompilerAdvice(std::ostream&, std::string const&, void PrintCompilerAdvice(std::ostream&, std::string const&,
const char*) const {} const char*) const {}
std::string GetObjectsNormalDirectory( std::string GetObjectsNormalDirectory(const std::string &projName,
const std::string &projName,
const std::string &configName, const std::string &configName,
const cmTarget *t) const; const cmGeneratorTarget *t) const;
void addObject(cmXCodeObject *obj); void addObject(cmXCodeObject *obj);
std::string PostBuildMakeTarget(std::string const& tName, std::string PostBuildMakeTarget(std::string const& tName,
@ -251,7 +250,7 @@ private:
std::map<std::string, cmXCodeObject* > GroupNameMap; std::map<std::string, cmXCodeObject* > GroupNameMap;
std::map<std::string, cmXCodeObject* > TargetGroup; std::map<std::string, cmXCodeObject* > TargetGroup;
std::map<std::string, cmXCodeObject* > FileRefs; std::map<std::string, cmXCodeObject* > FileRefs;
std::map<cmTarget const*, cmXCodeObject* > XCodeObjectMap; std::map<cmGeneratorTarget const*, cmXCodeObject* > XCodeObjectMap;
std::vector<std::string> Architectures; std::vector<std::string> Architectures;
std::string GeneratorToolset; std::string GeneratorToolset;
}; };

View File

@ -17,7 +17,7 @@
static const char* getShapeForTarget(const cmTarget* target) static const char* getShapeForTarget(const cmGeneratorTarget* target)
{ {
if (!target) if (!target)
{ {
@ -163,7 +163,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
this->CollectTargetsAndLibs(); this->CollectTargetsAndLibs();
for(std::map<std::string, const cmTarget*>::const_iterator ptrIt = for(std::map<std::string, const cmGeneratorTarget*>::const_iterator ptrIt =
this->TargetPtrs.begin(); this->TargetPtrs.begin();
ptrIt != this->TargetPtrs.end(); ptrIt != this->TargetPtrs.end();
++ptrIt) ++ptrIt)
@ -214,7 +214,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
this->CollectTargetsAndLibs(); this->CollectTargetsAndLibs();
for(std::map<std::string, const cmTarget*>::const_iterator ptrIt = for(std::map<std::string, const cmGeneratorTarget*>::const_iterator ptrIt =
this->TargetPtrs.begin(); this->TargetPtrs.begin();
ptrIt != this->TargetPtrs.end(); ptrIt != this->TargetPtrs.end();
++ptrIt) ++ptrIt)
@ -268,7 +268,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName)
std::set<std::string> insertedConnections; std::set<std::string> insertedConnections;
std::set<std::string> insertedNodes; std::set<std::string> insertedNodes;
for(std::map<std::string, const cmTarget*>::const_iterator ptrIt = for(std::map<std::string, const cmGeneratorTarget*>::const_iterator ptrIt =
this->TargetPtrs.begin(); this->TargetPtrs.begin();
ptrIt != this->TargetPtrs.end(); ptrIt != this->TargetPtrs.end();
++ptrIt) ++ptrIt)
@ -308,8 +308,8 @@ void cmGraphVizWriter::WriteConnections(const std::string& targetName,
std::set<std::string>& insertedConnections, std::set<std::string>& insertedConnections,
cmGeneratedFileStream& str) const cmGeneratedFileStream& str) const
{ {
std::map<std::string, const cmTarget* >::const_iterator targetPtrIt = std::map<std::string, const cmGeneratorTarget* >::const_iterator targetPtrIt
this->TargetPtrs.find(targetName); = this->TargetPtrs.find(targetName);
if (targetPtrIt == this->TargetPtrs.end()) // not found at all if (targetPtrIt == this->TargetPtrs.end()) // not found at all
{ {
@ -327,7 +327,7 @@ void cmGraphVizWriter::WriteConnections(const std::string& targetName,
std::string myNodeName = this->TargetNamesNodes.find(targetName)->second; std::string myNodeName = this->TargetNamesNodes.find(targetName)->second;
const cmTarget::LinkLibraryVectorType* ll = const cmTarget::LinkLibraryVectorType* ll =
&(targetPtrIt->second->GetOriginalLinkLibraries()); &(targetPtrIt->second->Target->GetOriginalLinkLibraries());
for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin(); for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin();
llit != ll->end(); llit != ll->end();
@ -367,8 +367,8 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName,
std::set<std::string>& insertedConnections, std::set<std::string>& insertedConnections,
cmGeneratedFileStream& str) const cmGeneratedFileStream& str) const
{ {
std::map<std::string, const cmTarget* >::const_iterator targetPtrIt = std::map<std::string, const cmGeneratorTarget* >::const_iterator targetPtrIt
this->TargetPtrs.find(targetName); = this->TargetPtrs.find(targetName);
if (targetPtrIt == this->TargetPtrs.end()) // not found at all if (targetPtrIt == this->TargetPtrs.end()) // not found at all
{ {
@ -386,8 +386,8 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName,
std::string myNodeName = this->TargetNamesNodes.find(targetName)->second; std::string myNodeName = this->TargetNamesNodes.find(targetName)->second;
// now search who links against me // now search who links against me
for(std::map<std::string, const cmTarget*>::const_iterator dependerIt = for(std::map<std::string, const cmGeneratorTarget*>::const_iterator
this->TargetPtrs.begin(); dependerIt = this->TargetPtrs.begin();
dependerIt != this->TargetPtrs.end(); dependerIt != this->TargetPtrs.end();
++dependerIt) ++dependerIt)
{ {
@ -404,7 +404,7 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName,
// Now we have a target, check whether it links against targetName. // Now we have a target, check whether it links against targetName.
// If so, draw a connection, and then continue with dependers on that one. // If so, draw a connection, and then continue with dependers on that one.
const cmTarget::LinkLibraryVectorType* ll = const cmTarget::LinkLibraryVectorType* ll =
&(dependerIt->second->GetOriginalLinkLibraries()); &(dependerIt->second->Target->GetOriginalLinkLibraries());
for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin(); for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin();
llit != ll->end(); llit != ll->end();
@ -448,7 +448,7 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName,
void cmGraphVizWriter::WriteNode(const std::string& targetName, void cmGraphVizWriter::WriteNode(const std::string& targetName,
const cmTarget* target, const cmGeneratorTarget* target,
std::set<std::string>& insertedNodes, std::set<std::string>& insertedNodes,
cmGeneratedFileStream& str) const cmGeneratedFileStream& str) const
{ {
@ -488,12 +488,11 @@ int cmGraphVizWriter::CollectAllTargets()
lit != this->LocalGenerators.end(); lit != this->LocalGenerators.end();
++ lit ) ++ lit )
{ {
const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets()); std::vector<cmGeneratorTarget*> targets = (*lit)->GetGeneratorTargets();
for ( cmTargets::const_iterator tit = targets->begin(); for ( std::vector<cmGeneratorTarget*>::const_iterator it =
tit != targets->end(); targets.begin(); it != targets.end(); ++it )
++ tit )
{ {
const char* realTargetName = tit->first.c_str(); const char* realTargetName = (*it)->GetName().c_str();
if(this->IgnoreThisTarget(realTargetName)) if(this->IgnoreThisTarget(realTargetName))
{ {
// Skip ignored targets // Skip ignored targets
@ -503,7 +502,7 @@ int cmGraphVizWriter::CollectAllTargets()
std::ostringstream ostr; std::ostringstream ostr;
ostr << this->GraphNodePrefix << cnt++; ostr << this->GraphNodePrefix << cnt++;
this->TargetNamesNodes[realTargetName] = ostr.str(); this->TargetNamesNodes[realTargetName] = ostr.str();
this->TargetPtrs[realTargetName] = &tit->second; this->TargetPtrs[realTargetName] = *it;
} }
} }
@ -519,19 +518,18 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
lit != this->LocalGenerators.end(); lit != this->LocalGenerators.end();
++ lit ) ++ lit )
{ {
const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets()); std::vector<cmGeneratorTarget*> targets = (*lit)->GetGeneratorTargets();
for ( cmTargets::const_iterator tit = targets->begin(); for ( std::vector<cmGeneratorTarget*>::const_iterator it =
tit != targets->end(); targets.begin(); it != targets.end(); ++it )
++ tit )
{ {
const char* realTargetName = tit->first.c_str(); const char* realTargetName = (*it)->GetName().c_str();
if (this->IgnoreThisTarget(realTargetName)) if (this->IgnoreThisTarget(realTargetName))
{ {
// Skip ignored targets // Skip ignored targets
continue; continue;
} }
const cmTarget::LinkLibraryVectorType* ll = const cmTarget::LinkLibraryVectorType* ll =
&(tit->second.GetOriginalLinkLibraries()); &((*it)->Target->GetOriginalLinkLibraries());
for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin(); for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin();
llit != ll->end(); llit != ll->end();
++ llit ) ++ llit )
@ -543,8 +541,8 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
continue; continue;
} }
std::map<std::string, const cmTarget*>::const_iterator tarIt = std::map<std::string, const cmGeneratorTarget*>::const_iterator tarIt
this->TargetPtrs.find(libName); = this->TargetPtrs.find(libName);
if ( tarIt == this->TargetPtrs.end() ) if ( tarIt == this->TargetPtrs.end() )
{ {
std::ostringstream ostr; std::ostringstream ostr;

View File

@ -14,9 +14,9 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include "cmLocalGenerator.h" #include "cmLocalGenerator.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmTarget.h"
#include <cmsys/RegularExpression.hxx> #include <cmsys/RegularExpression.hxx>
class cmGeneratorTarget;
/** This class implements writing files for graphviz (dot) for graphs /** This class implements writing files for graphviz (dot) for graphs
* representing the dependencies between the targets in the project. */ * representing the dependencies between the targets in the project. */
@ -54,7 +54,8 @@ protected:
std::set<std::string>& insertedConnections, std::set<std::string>& insertedConnections,
cmGeneratedFileStream& str) const; cmGeneratedFileStream& str) const;
void WriteNode(const std::string& targetName, const cmTarget* target, void WriteNode(const std::string& targetName,
const cmGeneratorTarget* target,
std::set<std::string>& insertedNodes, std::set<std::string>& insertedNodes,
cmGeneratedFileStream& str) const; cmGeneratedFileStream& str) const;
@ -73,7 +74,7 @@ protected:
const std::vector<cmLocalGenerator*>& LocalGenerators; const std::vector<cmLocalGenerator*>& LocalGenerators;
std::map<std::string, const cmTarget*> TargetPtrs; std::map<std::string, const cmGeneratorTarget*> TargetPtrs;
// maps from the actual target names to node names in dot: // maps from the actual target names to node names in dot:
std::map<std::string, std::string> TargetNamesNodes; std::map<std::string, std::string> TargetNamesNodes;

View File

@ -76,7 +76,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
if(this->Target->NeedRelinkBeforeInstall(config)) if(this->Target->NeedRelinkBeforeInstall(config))
{ {
fromDirConfig = fromDirConfig =
this->Target->Target->GetMakefile()->GetCurrentBinaryDirectory(); this->Target->GetLocalGenerator()->GetCurrentBinaryDirectory();
fromDirConfig += cmake::GetCMakeFilesDirectory(); fromDirConfig += cmake::GetCMakeFilesDirectory();
fromDirConfig += "/CMakeRelink.dir/"; fromDirConfig += "/CMakeRelink.dir/";
} }
@ -111,7 +111,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
case cmState::UTILITY: case cmState::UTILITY:
case cmState::GLOBAL_TARGET: case cmState::GLOBAL_TARGET:
case cmState::UNKNOWN_LIBRARY: case cmState::UNKNOWN_LIBRARY:
this->Target->Target->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, this->Target->GetLocalGenerator()->IssueMessage(cmake::INTERNAL_ERROR,
"cmInstallTargetGenerator created with non-installable target."); "cmInstallTargetGenerator created with non-installable target.");
return; return;
} }
@ -440,8 +440,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmGeneratorTarget const* target,
void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg) void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg)
{ {
this->Target = lg->GetGlobalGenerator()->GetGeneratorTarget( this->Target = lg->FindGeneratorTarget(this->TargetName);
lg->GetMakefile()->FindTarget(this->TargetName));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -132,15 +132,15 @@ void cmLocalGenerator::TraceDependencies()
this->GlobalGenerator->CreateEvaluationSourceFiles(*ci); this->GlobalGenerator->CreateEvaluationSourceFiles(*ci);
} }
// Generate the rule files for each target. // Generate the rule files for each target.
cmGeneratorTargetsType targets = this->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
for(cmGeneratorTargetsType::iterator t = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
if (t->second->GetType() == cmState::INTERFACE_LIBRARY) if ((*t)->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
t->second->TraceDependencies(); (*t)->TraceDependencies();
} }
} }
@ -448,9 +448,16 @@ void cmLocalGenerator::GenerateInstallRules()
} }
void cmLocalGenerator::AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt) void cmLocalGenerator::AddGeneratorTarget(cmGeneratorTarget* gt)
{ {
this->GeneratorTargets[t] = gt; this->GeneratorTargets.push_back(gt);
}
cmGeneratorTarget* cmLocalGenerator::FindGeneratorTarget(
const std::string& name) const
{
return this->GetGlobalGenerator()->GetGeneratorTarget(
this->Makefile->FindTarget(name));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -465,12 +472,12 @@ void cmLocalGenerator::ComputeTargetManifest()
} }
// Add our targets to the manifest for each configuration. // Add our targets to the manifest for each configuration.
cmGeneratorTargetsType targets = this->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
for(cmGeneratorTargetsType::iterator t = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
cmGeneratorTarget& target = *t->second; cmGeneratorTarget* target = *t;
if (target.GetType() == cmState::INTERFACE_LIBRARY) if (target->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
@ -478,7 +485,7 @@ void cmLocalGenerator::ComputeTargetManifest()
ci != configNames.end(); ++ci) ci != configNames.end(); ++ci)
{ {
const char* config = ci->c_str(); const char* config = ci->c_str();
target.ComputeTargetManifest(config); target->ComputeTargetManifest(config);
} }
} }
} }
@ -2133,7 +2140,7 @@ void cmLocalGenerator
"has the following visibility properties set for " << lang << ":\n" << "has the following visibility properties set for " << lang << ":\n" <<
warnCMP0063 << warnCMP0063 <<
"For compatibility CMake is not honoring them for this target."; "For compatibility CMake is not honoring them for this target.";
target->Target->GetMakefile()->GetCMakeInstance() target->GetLocalGenerator()->GetCMakeInstance()
->IssueMessage(cmake::AUTHOR_WARNING, w.str(), ->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
target->GetBacktrace()); target->GetBacktrace());
} }
@ -2503,28 +2510,29 @@ cmLocalGenerator
{ {
// Convert the old-style install specification from each target to // Convert the old-style install specification from each target to
// an install generator and run it. // an install generator and run it.
cmTargets& tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l)
{ {
if (l->second.GetType() == cmState::INTERFACE_LIBRARY) if ((*l)->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
// Include the user-specified pre-install script for this target. // Include the user-specified pre-install script for this target.
if(const char* preinstall = l->second.GetProperty("PRE_INSTALL_SCRIPT")) if(const char* preinstall = (*l)->GetProperty("PRE_INSTALL_SCRIPT"))
{ {
cmInstallScriptGenerator g(preinstall, false, 0); cmInstallScriptGenerator g(preinstall, false, 0);
g.Generate(os, config, configurationTypes); g.Generate(os, config, configurationTypes);
} }
// Install this target if a destination is given. // Install this target if a destination is given.
if(l->second.GetInstallPath() != "") if((*l)->Target->GetInstallPath() != "")
{ {
// Compute the full install destination. Note that converting // Compute the full install destination. Note that converting
// to unix slashes also removes any trailing slash. // to unix slashes also removes any trailing slash.
// We also skip over the leading slash given by the user. // We also skip over the leading slash given by the user.
std::string destination = l->second.GetInstallPath().substr(1); std::string destination = (*l)->Target->GetInstallPath().substr(1);
cmSystemTools::ConvertToUnixSlashes(destination); cmSystemTools::ConvertToUnixSlashes(destination);
if(destination.empty()) if(destination.empty())
{ {
@ -2532,7 +2540,7 @@ cmLocalGenerator
} }
// Generate the proper install generator for this target type. // Generate the proper install generator for this target type.
switch(l->second.GetType()) switch((*l)->GetType())
{ {
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
@ -2540,7 +2548,7 @@ cmLocalGenerator
{ {
// Use a target install generator. // Use a target install generator.
cmInstallTargetGeneratorLocal cmInstallTargetGeneratorLocal
g(this, l->first, destination.c_str(), false); g(this, (*l)->GetName(), destination.c_str(), false);
g.Generate(os, config, configurationTypes); g.Generate(os, config, configurationTypes);
} }
break; break;
@ -2551,18 +2559,18 @@ cmLocalGenerator
// to the normal destination and the DLL to the runtime // to the normal destination and the DLL to the runtime
// destination. // destination.
cmInstallTargetGeneratorLocal cmInstallTargetGeneratorLocal
g1(this, l->first, destination.c_str(), true); g1(this, (*l)->GetName(), destination.c_str(), true);
g1.Generate(os, config, configurationTypes); g1.Generate(os, config, configurationTypes);
// We also skip over the leading slash given by the user. // We also skip over the leading slash given by the user.
destination = l->second.GetRuntimeInstallPath().substr(1); destination = (*l)->Target->GetRuntimeInstallPath().substr(1);
cmSystemTools::ConvertToUnixSlashes(destination); cmSystemTools::ConvertToUnixSlashes(destination);
cmInstallTargetGeneratorLocal cmInstallTargetGeneratorLocal
g2(this, l->first, destination.c_str(), false); g2(this, (*l)->GetName(), destination.c_str(), false);
g2.Generate(os, config, configurationTypes); g2.Generate(os, config, configurationTypes);
#else #else
// Use a target install generator. // Use a target install generator.
cmInstallTargetGeneratorLocal cmInstallTargetGeneratorLocal
g(this, l->first, destination.c_str(), false); g(this, (*l)->GetName(), destination.c_str(), false);
g.Generate(os, config, configurationTypes); g.Generate(os, config, configurationTypes);
#endif #endif
} }
@ -2573,7 +2581,7 @@ cmLocalGenerator
} }
// Include the user-specified post-install script for this target. // Include the user-specified post-install script for this target.
if(const char* postinstall = l->second.GetProperty("POST_INSTALL_SCRIPT")) if(const char* postinstall = (*l)->GetProperty("POST_INSTALL_SCRIPT"))
{ {
cmInstallScriptGenerator g(postinstall, false, 0); cmInstallScriptGenerator g(postinstall, false, 0);
g.Generate(os, config, configurationTypes); g.Generate(os, config, configurationTypes);

View File

@ -113,13 +113,14 @@ public:
bool forResponseFile = false, bool forResponseFile = false,
const std::string& config = ""); const std::string& config = "");
const cmGeneratorTargetsType &GetGeneratorTargets() const const std::vector<cmGeneratorTarget*> &GetGeneratorTargets() const
{ {
return this->GeneratorTargets; return this->GeneratorTargets;
} }
void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt); void AddGeneratorTarget(cmGeneratorTarget* gt);
cmGeneratorTarget* FindGeneratorTarget(const std::string& name) const;
cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const; cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;
/** /**
@ -367,7 +368,7 @@ protected:
std::set<std::string> ObjectMaxPathViolations; std::set<std::string> ObjectMaxPathViolations;
std::set<cmGeneratorTarget const*> WarnCMP0063; std::set<cmGeneratorTarget const*> WarnCMP0063;
cmGeneratorTargetsType GeneratorTargets; std::vector<cmGeneratorTarget*> GeneratorTargets;
bool EmitUniversalBinaryFlags; bool EmitUniversalBinaryFlags;

View File

@ -26,16 +26,16 @@ cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() {}
void cmLocalGhsMultiGenerator::Generate() void cmLocalGhsMultiGenerator::Generate()
{ {
cmGeneratorTargetsType tgts = this->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for (cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
++l) l != tgts.end(); ++l)
{ {
if (l->second->GetType() == cmState::INTERFACE_LIBRARY) if ((*l)->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
cmGhsMultiTargetGenerator tg(l->second); cmGhsMultiTargetGenerator tg(*l);
tg.Generate(); tg.Generate();
} }
} }

View File

@ -73,23 +73,23 @@ void cmLocalNinjaGenerator::Generate()
} }
} }
cmGeneratorTargetsType targets = this->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
for(cmGeneratorTargetsType::iterator t = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
if (t->second->GetType() == cmState::INTERFACE_LIBRARY) if ((*t)->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
cmNinjaTargetGenerator* tg = cmNinjaTargetGenerator::New(t->second); cmNinjaTargetGenerator* tg = cmNinjaTargetGenerator::New(*t);
if(tg) if(tg)
{ {
tg->Generate(); tg->Generate();
// Add the target to "all" if required. // Add the target to "all" if required.
if (!this->GetGlobalNinjaGenerator()->IsExcluded( if (!this->GetGlobalNinjaGenerator()->IsExcluded(
this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0],
t->second)) *t))
this->GetGlobalNinjaGenerator()->AddDependencyToAll(t->second->Target); this->GetGlobalNinjaGenerator()->AddDependencyToAll(*t);
delete tg; delete tg;
} }
} }
@ -285,14 +285,14 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os)
void void
cmLocalNinjaGenerator cmLocalNinjaGenerator
::AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs) ::AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs)
{ {
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(target, outputs); this->GetGlobalNinjaGenerator()->AppendTargetOutputs(target, outputs);
} }
void void
cmLocalNinjaGenerator cmLocalNinjaGenerator
::AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs) ::AppendTargetDepends(cmGeneratorTarget* target, cmNinjaDeps& outputs)
{ {
this->GetGlobalNinjaGenerator()->AppendTargetDepends(target, outputs); this->GetGlobalNinjaGenerator()->AppendTargetDepends(target, outputs);
} }
@ -441,7 +441,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
} }
void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc, void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc,
cmTarget* target) cmGeneratorTarget* target)
{ {
this->CustomCommandTargets[cc].insert(target); this->CustomCommandTargets[cc].insert(target);
} }
@ -459,7 +459,7 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
// //
// FIXME: This won't work in certain obscure scenarios involving indirect // FIXME: This won't work in certain obscure scenarios involving indirect
// dependencies. // dependencies.
std::set<cmTarget*>::iterator j = i->second.begin(); std::set<cmGeneratorTarget*>::iterator j = i->second.begin();
assert(j != i->second.end()); assert(j != i->second.end());
std::vector<std::string> ccTargetDeps; std::vector<std::string> ccTargetDeps;
this->AppendTargetDepends(*j, ccTargetDeps); this->AppendTargetDepends(*j, ccTargetDeps);

View File

@ -58,10 +58,11 @@ public:
std::string BuildCommandLine(const std::vector<std::string> &cmdLines); std::string BuildCommandLine(const std::vector<std::string> &cmdLines);
void AppendTargetOutputs(cmTarget* target, cmNinjaDeps& outputs); void AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs);
void AppendTargetDepends(cmTarget* target, cmNinjaDeps& outputs); void AppendTargetDepends(cmGeneratorTarget* target, cmNinjaDeps& outputs);
void AddCustomCommandTarget(cmCustomCommand const* cc, cmTarget* target); void AddCustomCommandTarget(cmCustomCommand const* cc,
cmGeneratorTarget* target);
void AppendCustomCommandLines(cmCustomCommandGenerator const& ccg, void AppendCustomCommandLines(cmCustomCommandGenerator const& ccg,
std::vector<std::string> &cmdLines); std::vector<std::string> &cmdLines);
void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg, void AppendCustomCommandDeps(cmCustomCommandGenerator const& ccg,
@ -102,7 +103,7 @@ private:
std::string HomeRelativeOutputPath; std::string HomeRelativeOutputPath;
typedef std::map<cmCustomCommand const*, std::set<cmTarget*> > typedef std::map<cmCustomCommand const*, std::set<cmGeneratorTarget*> >
CustomCommandTargetMap; CustomCommandTargetMap;
CustomCommandTargetMap CustomCommandTargets; CustomCommandTargetMap CustomCommandTargets;
}; };

View File

@ -113,18 +113,18 @@ void cmLocalUnixMakefileGenerator3::Generate()
this->Makefile->IsOn("CMAKE_SKIP_ASSEMBLY_SOURCE_RULES"); this->Makefile->IsOn("CMAKE_SKIP_ASSEMBLY_SOURCE_RULES");
// Generate the rule files for each target. // Generate the rule files for each target.
cmGeneratorTargetsType targets = this->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
cmGlobalUnixMakefileGenerator3* gg = cmGlobalUnixMakefileGenerator3* gg =
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
for(cmGeneratorTargetsType::iterator t = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
if (t->second->GetType() == cmState::INTERFACE_LIBRARY) if ((*t)->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
cmsys::auto_ptr<cmMakefileTargetGenerator> tg( cmsys::auto_ptr<cmMakefileTargetGenerator> tg(
cmMakefileTargetGenerator::New(t->second)); cmMakefileTargetGenerator::New(*t));
if (tg.get()) if (tg.get())
{ {
tg->WriteRuleFiles(); tg->WriteRuleFiles();
@ -174,11 +174,11 @@ void cmLocalUnixMakefileGenerator3::
GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles) GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
{ {
std::set<std::string> emitted; std::set<std::string> emitted;
cmGeneratorTargetsType targets = this->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
for(cmGeneratorTargetsType::iterator ti = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ++ti) ti != targets.end(); ++ti)
{ {
cmGeneratorTarget* gt = ti->second; cmGeneratorTarget* gt = *ti;
if (gt->GetType() == cmState::INTERFACE_LIBRARY) if (gt->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
@ -188,7 +188,7 @@ GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
->GetSafeDefinition("CMAKE_BUILD_TYPE")); ->GetSafeDefinition("CMAKE_BUILD_TYPE"));
// Compute full path to object file directory for this target. // Compute full path to object file directory for this target.
std::string dir; std::string dir;
dir += gt->Makefile->GetCurrentBinaryDirectory(); dir += gt->LocalGenerator->GetCurrentBinaryDirectory();
dir += "/"; dir += "/";
dir += this->GetTargetDirectory(gt); dir += this->GetTargetDirectory(gt);
dir += "/"; dir += "/";
@ -417,22 +417,22 @@ void cmLocalUnixMakefileGenerator3
// for each target we just provide a rule to cd up to the top and do a make // for each target we just provide a rule to cd up to the top and do a make
// on the target // on the target
cmGeneratorTargetsType targets = this->GetGeneratorTargets(); std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
std::string localName; std::string localName;
for(cmGeneratorTargetsType::iterator t = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t) t != targets.end(); ++t)
{ {
if((t->second->GetType() == cmState::EXECUTABLE) || if(((*t)->GetType() == cmState::EXECUTABLE) ||
(t->second->GetType() == cmState::STATIC_LIBRARY) || ((*t)->GetType() == cmState::STATIC_LIBRARY) ||
(t->second->GetType() == cmState::SHARED_LIBRARY) || ((*t)->GetType() == cmState::SHARED_LIBRARY) ||
(t->second->GetType() == cmState::MODULE_LIBRARY) || ((*t)->GetType() == cmState::MODULE_LIBRARY) ||
(t->second->GetType() == cmState::OBJECT_LIBRARY) || ((*t)->GetType() == cmState::OBJECT_LIBRARY) ||
(t->second->GetType() == cmState::UTILITY)) ((*t)->GetType() == cmState::UTILITY))
{ {
emitted.insert(t->second->GetName()); emitted.insert((*t)->GetName());
// for subdirs add a rule to build this specific target by name. // for subdirs add a rule to build this specific target by name.
localName = this->GetRelativeTargetDirectory(t->second); localName = this->GetRelativeTargetDirectory(*t);
localName += "/rule"; localName += "/rule";
commands.clear(); commands.clear();
depends.clear(); depends.clear();
@ -449,23 +449,23 @@ void cmLocalUnixMakefileGenerator3
localName, depends, commands, true); localName, depends, commands, true);
// Add a target with the canonical name (no prefix, suffix or path). // Add a target with the canonical name (no prefix, suffix or path).
if(localName != t->second->GetName()) if(localName != (*t)->GetName())
{ {
commands.clear(); commands.clear();
depends.push_back(localName); depends.push_back(localName);
this->WriteMakeRule(ruleFileStream, "Convenience name for target.", this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
t->second->GetName(), depends, commands, true); (*t)->GetName(), depends, commands, true);
} }
// Add a fast rule to build the target // Add a fast rule to build the target
std::string makefileName = std::string makefileName =
this->GetRelativeTargetDirectory(t->second); this->GetRelativeTargetDirectory(*t);
makefileName += "/build.make"; makefileName += "/build.make";
// make sure the makefile name is suitable for a makefile // make sure the makefile name is suitable for a makefile
std::string makeTargetName = std::string makeTargetName =
this->GetRelativeTargetDirectory(t->second); this->GetRelativeTargetDirectory(*t);
makeTargetName += "/build"; makeTargetName += "/build";
localName = t->second->GetName(); localName = (*t)->GetName();
localName += "/fast"; localName += "/fast";
depends.clear(); depends.clear();
commands.clear(); commands.clear();
@ -479,11 +479,11 @@ void cmLocalUnixMakefileGenerator3
// Add a local name for the rule to relink the target before // Add a local name for the rule to relink the target before
// installation. // installation.
if(t->second->NeedRelinkBeforeInstall(this->ConfigName)) if((*t)->NeedRelinkBeforeInstall(this->ConfigName))
{ {
makeTargetName = this->GetRelativeTargetDirectory(t->second); makeTargetName = this->GetRelativeTargetDirectory(*t);
makeTargetName += "/preinstall"; makeTargetName += "/preinstall";
localName = t->second->GetName(); localName = (*t)->GetName();
localName += "/preinstall"; localName += "/preinstall";
depends.clear(); depends.clear();
commands.clear(); commands.clear();
@ -1762,43 +1762,43 @@ void cmLocalUnixMakefileGenerator3
ruleFileStream ruleFileStream
<< "# Targets provided globally by CMake.\n" << "# Targets provided globally by CMake.\n"
<< "\n"; << "\n";
cmTargets* targets = &(this->Makefile->GetTargets()); std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
cmTargets::iterator glIt; std::vector<cmGeneratorTarget*>::iterator glIt;
for ( glIt = targets->begin(); glIt != targets->end(); ++ glIt ) for ( glIt = targets.begin(); glIt != targets.end(); ++ glIt )
{ {
if ( glIt->second.GetType() == cmState::GLOBAL_TARGET ) if ( (*glIt)->GetType() == cmState::GLOBAL_TARGET )
{ {
std::string targetString = "Special rule for the target " + glIt->first; std::string targetString = "Special rule for the target " +
(*glIt)->GetName();
std::vector<std::string> commands; std::vector<std::string> commands;
std::vector<std::string> depends; std::vector<std::string> depends;
const char* text = glIt->second.GetProperty("EchoString"); const char* text = (*glIt)->GetProperty("EchoString");
if ( !text ) if ( !text )
{ {
text = "Running external command ..."; text = "Running external command ...";
} }
depends.insert(depends.end(), glIt->second.GetUtilities().begin(), depends.insert(depends.end(), (*glIt)->Target->GetUtilities().begin(),
glIt->second.GetUtilities().end()); (*glIt)->Target->GetUtilities().end());
this->AppendEcho(commands, text, this->AppendEcho(commands, text,
cmLocalUnixMakefileGenerator3::EchoGlobal); cmLocalUnixMakefileGenerator3::EchoGlobal);
cmGeneratorTarget* gt = this->GlobalGenerator cmGeneratorTarget* gt = *glIt;
->GetGeneratorTarget(&glIt->second);
// Global targets store their rules in pre- and post-build commands. // Global targets store their rules in pre- and post-build commands.
this->AppendCustomDepends(depends, this->AppendCustomDepends(depends,
glIt->second.GetPreBuildCommands()); gt->Target->GetPreBuildCommands());
this->AppendCustomDepends(depends, this->AppendCustomDepends(depends,
glIt->second.GetPostBuildCommands()); gt->Target->GetPostBuildCommands());
this->AppendCustomCommands(commands, this->AppendCustomCommands(commands,
glIt->second.GetPreBuildCommands(), gt->Target->GetPreBuildCommands(),
gt, gt,
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
this->AppendCustomCommands(commands, this->AppendCustomCommands(commands,
glIt->second.GetPostBuildCommands(), gt->Target->GetPostBuildCommands(),
gt, gt,
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
std::string targetName = glIt->second.GetName(); std::string targetName = gt->GetName();
this->WriteMakeRule(ruleFileStream, targetString.c_str(), this->WriteMakeRule(ruleFileStream, targetString.c_str(),
targetName, depends, commands, true); targetName, depends, commands, true);
@ -1977,7 +1977,7 @@ void cmLocalUnixMakefileGenerator3
cmGeneratorTarget* target) cmGeneratorTarget* target)
{ {
ImplicitDependLanguageMap const& implicitLangs = ImplicitDependLanguageMap const& implicitLangs =
this->GetImplicitDepends(*target->Target); this->GetImplicitDepends(target);
// list the languages // list the languages
cmakefileStream cmakefileStream
@ -2292,19 +2292,20 @@ cmLocalUnixMakefileGenerator3
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmLocalUnixMakefileGenerator3::ImplicitDependLanguageMap const& cmLocalUnixMakefileGenerator3::ImplicitDependLanguageMap const&
cmLocalUnixMakefileGenerator3::GetImplicitDepends(cmTarget const& tgt) cmLocalUnixMakefileGenerator3::GetImplicitDepends(
const cmGeneratorTarget* tgt)
{ {
return this->ImplicitDepends[tgt.GetName()]; return this->ImplicitDepends[tgt->GetName()];
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmLocalUnixMakefileGenerator3::AddImplicitDepends(cmTarget const& tgt, cmLocalUnixMakefileGenerator3::AddImplicitDepends(const cmGeneratorTarget* tgt,
const std::string& lang, const std::string& lang,
const char* obj, const char* obj,
const char* src) const char* src)
{ {
this->ImplicitDepends[tgt.GetName()][lang][obj].push_back(src); this->ImplicitDepends[tgt->GetName()][lang][obj].push_back(src);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -21,7 +21,6 @@ class cmCustomCommand;
class cmCustomCommandGenerator; class cmCustomCommandGenerator;
class cmDepends; class cmDepends;
class cmMakefileTargetGenerator; class cmMakefileTargetGenerator;
class cmTarget;
class cmSourceFile; class cmSourceFile;
/** \class cmLocalUnixMakefileGenerator3 /** \class cmLocalUnixMakefileGenerator3
@ -141,9 +140,11 @@ public:
public std::map<std::string, ImplicitDependFileMap> {}; public std::map<std::string, ImplicitDependFileMap> {};
struct ImplicitDependTargetMap: struct ImplicitDependTargetMap:
public std::map<std::string, ImplicitDependLanguageMap> {}; public std::map<std::string, ImplicitDependLanguageMap> {};
ImplicitDependLanguageMap const& GetImplicitDepends(cmTarget const& tgt); ImplicitDependLanguageMap const&
GetImplicitDepends(cmGeneratorTarget const* tgt);
void AddImplicitDepends(cmTarget const& tgt, const std::string& lang, void AddImplicitDepends(cmGeneratorTarget const* tgt,
const std::string& lang,
const char* obj, const char* src); const char* obj, const char* src);
// write the target rules for the local Makefile into the stream // write the target rules for the local Makefile into the stream
@ -197,12 +198,12 @@ protected:
const std::string& helpTarget); const std::string& helpTarget);
void WriteTargetDependRule(std::ostream& ruleFileStream, void WriteTargetDependRule(std::ostream& ruleFileStream,
cmTarget& target); cmGeneratorTarget* target);
void WriteTargetCleanRule(std::ostream& ruleFileStream, void WriteTargetCleanRule(std::ostream& ruleFileStream,
cmTarget& target, cmGeneratorTarget* target,
const std::vector<std::string>& files); const std::vector<std::string>& files);
void WriteTargetRequiresRule(std::ostream& ruleFileStream, void WriteTargetRequiresRule(std::ostream& ruleFileStream,
cmTarget& target, cmGeneratorTarget* target,
const std::vector<std::string>& objects); const std::vector<std::string>& objects);
void AppendRuleDepend(std::vector<std::string>& depends, void AppendRuleDepend(std::vector<std::string>& depends,

View File

@ -74,22 +74,23 @@ cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
void cmLocalVisualStudio10Generator::Generate() void cmLocalVisualStudio10Generator::Generate()
{ {
cmTargets &tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l)
{ {
if(l->second.GetType() == cmState::INTERFACE_LIBRARY) if((*l)->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator) if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
->TargetIsFortranOnly(l->second)) ->TargetIsFortranOnly(*l))
{ {
this->CreateSingleVCProj(l->first.c_str(),l->second); this->CreateSingleVCProj((*l)->GetName().c_str(), *l);
} }
else else
{ {
cmVisualStudio10TargetGenerator tg( cmVisualStudio10TargetGenerator tg(
&l->second, static_cast<cmGlobalVisualStudio10Generator*>( *l, static_cast<cmGlobalVisualStudio10Generator*>(
this->GetGlobalGenerator())); this->GetGlobalGenerator()));
tg.Generate(); tg.Generate();
} }

View File

@ -82,12 +82,12 @@ private:
void cmLocalVisualStudio6Generator::AddCMakeListsRules() void cmLocalVisualStudio6Generator::AddCMakeListsRules()
{ {
cmTargets &tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(cmTargets::iterator l = tgts.begin(); for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++) l != tgts.end(); ++l)
{ {
if (l->second.GetType() == cmState::INTERFACE_LIBRARY if ((*l)->GetType() == cmState::INTERFACE_LIBRARY
|| l->second.GetType() == cmState::GLOBAL_TARGET) || (*l)->GetType() == cmState::GLOBAL_TARGET)
{ {
continue; continue;
} }
@ -98,7 +98,7 @@ void cmLocalVisualStudio6Generator::AddCMakeListsRules()
this->Makefile->GetDefinition("CMAKE_SUPPRESS_REGENERATION"); this->Makefile->GetDefinition("CMAKE_SUPPRESS_REGENERATION");
if (!cmSystemTools::IsOn(suppRegenRule)) if (!cmSystemTools::IsOn(suppRegenRule))
{ {
this->AddDSPBuildRule(l->second); this->AddDSPBuildRule(*l);
} }
} }
} }
@ -124,54 +124,56 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
// Create the DSP or set of DSP's for libraries and executables // Create the DSP or set of DSP's for libraries and executables
cmTargets &tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
// build any targets l != tgts.end(); ++l)
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{ {
switch(l->second.GetType()) switch((*l)->GetType())
{ {
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
this->SetBuildType(STATIC_LIBRARY, l->first.c_str(), l->second); this->SetBuildType(STATIC_LIBRARY,
(*l)->GetName().c_str(), *l);
break; break;
case cmState::SHARED_LIBRARY: case cmState::SHARED_LIBRARY:
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
this->SetBuildType(DLL, l->first.c_str(), l->second); this->SetBuildType(DLL,
(*l)->GetName().c_str(), *l);
break; break;
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
this->SetBuildType(EXECUTABLE,l->first.c_str(), l->second); this->SetBuildType(EXECUTABLE,
(*l)->GetName().c_str(), *l);
break; break;
case cmState::UTILITY: case cmState::UTILITY:
case cmState::GLOBAL_TARGET: case cmState::GLOBAL_TARGET:
this->SetBuildType(UTILITY, l->first.c_str(), l->second); this->SetBuildType(UTILITY,
(*l)->GetName().c_str(), *l);
break; break;
case cmState::INTERFACE_LIBRARY: case cmState::INTERFACE_LIBRARY:
continue; continue;
default: default:
cmSystemTools::Error("Bad target type: ", l->first.c_str()); cmSystemTools::Error("Bad target type: ", (*l)->GetName().c_str());
break; break;
} }
// INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
// so don't build a projectfile for it // so don't build a projectfile for it
const char* path = const char* path =
l->second.GetProperty("EXTERNAL_MSPROJECT"); (*l)->GetProperty("EXTERNAL_MSPROJECT");
if(!path) if(!path)
{ {
// check to see if the dsp is going into a sub-directory // check to see if the dsp is going into a sub-directory
std::string::size_type pos = l->first.rfind('/'); std::string::size_type pos = (*l)->GetName().rfind('/');
if(pos != std::string::npos) if(pos != std::string::npos)
{ {
std::string dir = this->GetCurrentBinaryDirectory(); std::string dir = this->GetCurrentBinaryDirectory();
dir += "/"; dir += "/";
dir += l->first.substr(0, pos); dir += (*l)->GetName().substr(0, pos);
if(!cmSystemTools::MakeDirectory(dir.c_str())) if(!cmSystemTools::MakeDirectory(dir.c_str()))
{ {
cmSystemTools::Error("Error creating directory: ", dir.c_str()); cmSystemTools::Error("Error creating directory: ", dir.c_str());
} }
} }
this->CreateSingleDSP(l->first.c_str(),l->second); this->CreateSingleDSP((*l)->GetName().c_str(), *l);
} }
} }
} }
@ -182,7 +184,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
extern std::string GetVS6TargetName(const std::string& targetName); extern std::string GetVS6TargetName(const std::string& targetName);
void cmLocalVisualStudio6Generator::CreateSingleDSP(const std::string& lname, void cmLocalVisualStudio6Generator::CreateSingleDSP(const std::string& lname,
cmTarget &target) cmGeneratorTarget* target)
{ {
// add to the list of projects // add to the list of projects
std::string pname = GetVS6TargetName(lname); std::string pname = GetVS6TargetName(lname);
@ -209,9 +211,9 @@ void cmLocalVisualStudio6Generator::CreateSingleDSP(const std::string& lname,
} }
void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmGeneratorTarget *tgt)
{ {
std::string dspname = GetVS6TargetName(tgt.GetName()); std::string dspname = GetVS6TargetName(tgt->GetName());
dspname += ".dsp.cmake"; dspname += ".dsp.cmake";
cmCustomCommandLine commandLine; cmCustomCommandLine commandLine;
commandLine.push_back(cmSystemTools::GetCMakeCommand()); commandLine.push_back(cmSystemTools::GetCMakeCommand());
@ -243,8 +245,7 @@ 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()))
{ {
cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&tgt); tgt->AddSource(makefileIn);
gt->AddSource(makefileIn);
} }
else else
{ {
@ -255,7 +256,7 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout, void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
const std::string& libName, const std::string& libName,
cmTarget &target) cmGeneratorTarget *target)
{ {
// For utility targets need custom command since pre- and post- // For utility targets need custom command since pre- and post-
// build does not do anything in Visual Studio 6. In order for the // build does not do anything in Visual Studio 6. In order for the
@ -263,23 +264,23 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
// special care for dependencies. The first rule must depend on all // special care for dependencies. The first rule must depend on all
// the dependencies of all the rules. The later rules must each // the dependencies of all the rules. The later rules must each
// depend only on the previous rule. // depend only on the previous rule.
if ((target.GetType() == cmState::UTILITY || if ((target->GetType() == cmState::UTILITY ||
target.GetType() == cmState::GLOBAL_TARGET) && target->GetType() == cmState::GLOBAL_TARGET) &&
(!target.GetPreBuildCommands().empty() || (!target->Target->GetPreBuildCommands().empty() ||
!target.GetPostBuildCommands().empty())) !target->Target->GetPostBuildCommands().empty()))
{ {
// Accumulate the dependencies of all the commands. // Accumulate the dependencies of all the commands.
std::vector<std::string> depends; std::vector<std::string> depends;
for (std::vector<cmCustomCommand>::const_iterator cr = for (std::vector<cmCustomCommand>::const_iterator cr =
target.GetPreBuildCommands().begin(); target->Target->GetPreBuildCommands().begin();
cr != target.GetPreBuildCommands().end(); ++cr) cr != target->Target->GetPreBuildCommands().end(); ++cr)
{ {
depends.insert(depends.end(), depends.insert(depends.end(),
cr->GetDepends().begin(), cr->GetDepends().end()); cr->GetDepends().begin(), cr->GetDepends().end());
} }
for (std::vector<cmCustomCommand>::const_iterator cr = for (std::vector<cmCustomCommand>::const_iterator cr =
target.GetPostBuildCommands().begin(); target->Target->GetPostBuildCommands().begin();
cr != target.GetPostBuildCommands().end(); ++cr) cr != target->Target->GetPostBuildCommands().end(); ++cr)
{ {
depends.insert(depends.end(), depends.insert(depends.end(),
cr->GetDepends().begin(), cr->GetDepends().end()); cr->GetDepends().begin(), cr->GetDepends().end());
@ -288,14 +289,14 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
// Add the pre- and post-build commands in order. // Add the pre- and post-build commands in order.
int count = 1; int count = 1;
for (std::vector<cmCustomCommand>::const_iterator cr = for (std::vector<cmCustomCommand>::const_iterator cr =
target.GetPreBuildCommands().begin(); target->Target->GetPreBuildCommands().begin();
cr != target.GetPreBuildCommands().end(); ++cr) cr != target->Target->GetPreBuildCommands().end(); ++cr)
{ {
this->AddUtilityCommandHack(target, count++, depends, *cr); this->AddUtilityCommandHack(target, count++, depends, *cr);
} }
for (std::vector<cmCustomCommand>::const_iterator cr = for (std::vector<cmCustomCommand>::const_iterator cr =
target.GetPostBuildCommands().begin(); target->Target->GetPostBuildCommands().begin();
cr != target.GetPostBuildCommands().end(); ++cr) cr != target->Target->GetPostBuildCommands().end(); ++cr)
{ {
this->AddUtilityCommandHack(target, count++, depends, *cr); this->AddUtilityCommandHack(target, count++, depends, *cr);
} }
@ -304,12 +305,9 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
// We may be modifying the source groups temporarily, so make a copy. // We may be modifying the source groups temporarily, so make a copy.
std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups(); std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
// get the classes from the source lists then add them to the groups // get the classes from the source lists then add them to the groups
std::vector<cmSourceFile*> classes; std::vector<cmSourceFile*> classes;
if (!gt->GetConfigCommonSourceFiles(classes)) if (!target->GetConfigCommonSourceFiles(classes))
{ {
return; return;
} }
@ -373,11 +371,9 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
} }
void cmLocalVisualStudio6Generator void cmLocalVisualStudio6Generator
::WriteGroup(const cmSourceGroup *sg, cmTarget& target, ::WriteGroup(const cmSourceGroup *sg, cmGeneratorTarget* target,
std::ostream &fout, const std::string& libName) std::ostream &fout, const std::string& libName)
{ {
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
const std::vector<const cmSourceFile *> &sourceFiles = const std::vector<const cmSourceFile *> &sourceFiles =
sg->GetSourceFiles(); sg->GetSourceFiles();
// If the group is empty, don't write it at all. // If the group is empty, don't write it at all.
@ -409,9 +405,10 @@ void cmLocalVisualStudio6Generator
std::string compileFlags; std::string compileFlags;
std::vector<std::string> depends; std::vector<std::string> depends;
std::string objectNameDir; std::string objectNameDir;
if(gt->HasExplicitObjectName(*sf)) if(target->HasExplicitObjectName(*sf))
{ {
objectNameDir = cmSystemTools::GetFilenamePath(gt->GetObjectName(*sf)); objectNameDir =
cmSystemTools::GetFilenamePath(target->GetObjectName(*sf));
} }
// Add per-source file flags. // Add per-source file flags.
@ -482,8 +479,8 @@ void cmLocalVisualStudio6Generator
cmSystemTools::ExpandListArgument(dependsValue, depends); cmSystemTools::ExpandListArgument(dependsValue, depends);
} }
if (GetVS6TargetName(source) != libName || if (GetVS6TargetName(source) != libName ||
target.GetType() == cmState::UTILITY || target->GetType() == cmState::UTILITY ||
target.GetType() == cmState::GLOBAL_TARGET) target->GetType() == cmState::GLOBAL_TARGET)
{ {
fout << "# Begin Source File\n\n"; fout << "# Begin Source File\n\n";
@ -573,15 +570,15 @@ void cmLocalVisualStudio6Generator
void void
cmLocalVisualStudio6Generator cmLocalVisualStudio6Generator
::AddUtilityCommandHack(cmTarget& target, int count, ::AddUtilityCommandHack(cmGeneratorTarget *target, int count,
std::vector<std::string>& depends, std::vector<std::string>& depends,
const cmCustomCommand& origCommand) const cmCustomCommand& origCommand)
{ {
// Create a fake output that forces the rule to run. // Create a fake output that forces the rule to run.
char* output = new char[(strlen(this->GetCurrentBinaryDirectory()) char* output = new char[(strlen(this->GetCurrentBinaryDirectory())
+ target.GetName().size() + 30)]; + target->GetName().size() + 30)];
sprintf(output,"%s/%s_force_%i", this->GetCurrentBinaryDirectory(), sprintf(output,"%s/%s_force_%i", this->GetCurrentBinaryDirectory(),
target.GetName().c_str(), count); target->GetName().c_str(), count);
const char* comment = origCommand.GetComment(); const char* comment = origCommand.GetComment();
if(!comment && origCommand.GetOutputs().empty()) if(!comment && origCommand.GetOutputs().empty())
{ {
@ -596,8 +593,7 @@ cmLocalVisualStudio6Generator
origCommand.GetCommandLines(), comment, origCommand.GetCommandLines(), comment,
origCommand.GetWorkingDirectory().c_str())) origCommand.GetWorkingDirectory().c_str()))
{ {
cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target); target->AddSource(outsf->GetFullPath());
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
@ -713,7 +709,7 @@ void cmLocalVisualStudio6Generator::WriteDSPEndGroup(std::ostream& fout)
void cmLocalVisualStudio6Generator::SetBuildType(BuildType b, void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
const std::string& libName, const std::string& libName,
cmTarget& target) cmGeneratorTarget *target)
{ {
std::string root= this->Makefile->GetRequiredDefinition("CMAKE_ROOT"); std::string root= this->Makefile->GetRequiredDefinition("CMAKE_ROOT");
const char *def= const char *def=
@ -745,7 +741,7 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
this->DSPFooterTemplate += "/DLLFooter.dsptemplate"; this->DSPFooterTemplate += "/DLLFooter.dsptemplate";
break; break;
case EXECUTABLE: case EXECUTABLE:
if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") ) if ( target->GetPropertyAsBool("WIN32_EXECUTABLE") )
{ {
this->DSPHeaderTemplate = root; this->DSPHeaderTemplate = root;
this->DSPHeaderTemplate += "/EXEWinHeader.dsptemplate"; this->DSPHeaderTemplate += "/EXEWinHeader.dsptemplate";
@ -797,19 +793,16 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmsys::auto_ptr<cmCustomCommand> cmsys::auto_ptr<cmCustomCommand>
cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target, cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmGeneratorTarget* target,
const std::string& config) const std::string& config)
{ {
cmsys::auto_ptr<cmCustomCommand> pcc; cmsys::auto_ptr<cmCustomCommand> pcc;
// VS6 forgets to create the output directory for archives if it // VS6 forgets to create the output directory for archives if it
// differs from the intermediate directory. // differs from the intermediate directory.
if(target.GetType() != cmState::STATIC_LIBRARY) { return pcc; } if(target->GetType() != cmState::STATIC_LIBRARY) { return pcc; }
cmGeneratorTarget* gt = std::string outDir = target->GetDirectory(config, false);
this->GlobalGenerator->GetGeneratorTarget(&target);
std::string outDir = gt->GetDirectory(config, false);
// Add a pre-link event to create the directory. // Add a pre-link event to create the directory.
cmCustomCommandLine command; cmCustomCommandLine command;
@ -831,11 +824,11 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target,
// look for custom rules on a target and collect them together // look for custom rules on a target and collect them together
std::string std::string
cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target, cmLocalVisualStudio6Generator::CreateTargetRules(cmGeneratorTarget *target,
const std::string& configName, const std::string& configName,
const std::string& /* libName */) const std::string& /* libName */)
{ {
if (target.GetType() >= cmState::UTILITY ) if (target->GetType() >= cmState::UTILITY )
{ {
return ""; return "";
} }
@ -845,8 +838,8 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target,
// Write the pre-build and pre-link together (VS6 does not support both). // Write the pre-build and pre-link together (VS6 does not support both).
event.Start("PreLink"); event.Start("PreLink");
event.Write(target.GetPreBuildCommands()); event.Write(target->Target->GetPreBuildCommands());
event.Write(target.GetPreLinkCommands()); event.Write(target->Target->GetPreLinkCommands());
cmsys::auto_ptr<cmCustomCommand> pcc( cmsys::auto_ptr<cmCustomCommand> pcc(
this->MaybeCreateImplibDir(target, configName, false)); this->MaybeCreateImplibDir(target, configName, false));
if(pcc.get()) if(pcc.get())
@ -862,7 +855,7 @@ cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target,
// Write the post-build rules. // Write the post-build rules.
event.Start("PostBuild"); event.Start("PostBuild");
event.Write(target.GetPostBuildCommands()); event.Write(target->Target->GetPostBuildCommands());
event.Finish(); event.Finish();
customRuleCode += "# End Special Build Tool\n"; customRuleCode += "# End Special Build Tool\n";
@ -881,7 +874,8 @@ inline std::string removeQuotes(const std::string& s)
std::string std::string
cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target, cmLocalVisualStudio6Generator::GetTargetIncludeOptions(
cmGeneratorTarget *target,
const std::string& config) const std::string& config)
{ {
std::string includeOptions; std::string includeOptions;
@ -892,12 +886,10 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target,
unsigned int maxIncludeLength = 3000; unsigned int maxIncludeLength = 3000;
bool useShortPath = false; bool useShortPath = false;
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
for(int j=0; j < 2; ++j) for(int j=0; j < 2; ++j)
{ {
std::vector<std::string> includes; std::vector<std::string> includes;
this->GetIncludeDirectories(includes, gt, "C", config); this->GetIncludeDirectories(includes, target, "C", config);
std::vector<std::string>::iterator i; std::vector<std::string>::iterator i;
for(i = includes.begin(); i != includes.end(); ++i) for(i = includes.begin(); i != includes.end(); ++i)
@ -945,11 +937,11 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target,
void cmLocalVisualStudio6Generator void cmLocalVisualStudio6Generator
::WriteDSPHeader(std::ostream& fout, ::WriteDSPHeader(std::ostream& fout,
const std::string& libName, cmTarget &target, const std::string& libName, cmGeneratorTarget* target,
std::vector<cmSourceGroup> &) std::vector<cmSourceGroup> &)
{ {
bool targetBuilds = (target.GetType() >= cmState::EXECUTABLE && bool targetBuilds = (target->GetType() >= cmState::EXECUTABLE &&
target.GetType() <= cmState::MODULE_LIBRARY); target->GetType() <= cmState::MODULE_LIBRARY);
#ifdef CM_USE_OLD_VS6 #ifdef CM_USE_OLD_VS6
// Lookup the library and executable output directories. // Lookup the library and executable output directories.
std::string libPath; std::string libPath;
@ -1059,7 +1051,8 @@ void cmLocalVisualStudio6Generator
} }
} }
std::vector<std::string>::const_iterator i; std::vector<std::string>::const_iterator i;
const std::vector<std::string>& libdirs = target.GetLinkDirectories(); const std::vector<std::string>& libdirs =
target->Target->GetLinkDirectories();
for(i = libdirs.begin(); i != libdirs.end(); ++i) for(i = libdirs.begin(); i != libdirs.end(); ++i)
{ {
std::string path = *i; std::string path = *i;
@ -1101,19 +1094,19 @@ void cmLocalVisualStudio6Generator
} }
// find link libraries // find link libraries
const cmTarget::LinkLibraryVectorType& libs = const cmTarget::LinkLibraryVectorType& libs =
target.GetLinkLibrariesForVS6(); target->Target->GetLinkLibrariesForVS6();
cmTarget::LinkLibraryVectorType::const_iterator j; cmTarget::LinkLibraryVectorType::const_iterator j;
for(j = libs.begin(); j != libs.end(); ++j) for(j = libs.begin(); j != libs.end(); ++j)
{ {
// add libraries to executables and dlls (but never include // add libraries to executables and dlls (but never include
// a library in a library, bad recursion) // a library in a library, bad recursion)
// NEVER LINK STATIC LIBRARIES TO OTHER STATIC LIBRARIES // NEVER LINK STATIC LIBRARIES TO OTHER STATIC LIBRARIES
if ((target.GetType() != cmState::SHARED_LIBRARY if ((target->GetType() != cmState::SHARED_LIBRARY
&& target.GetType() != cmState::STATIC_LIBRARY && target->GetType() != cmState::STATIC_LIBRARY
&& target.GetType() != cmState::MODULE_LIBRARY) || && target->GetType() != cmState::MODULE_LIBRARY) ||
(target.GetType()==cmState::SHARED_LIBRARY (target->GetType()==cmState::SHARED_LIBRARY
&& libName != GetVS6TargetName(j->first)) || && libName != GetVS6TargetName(j->first)) ||
(target.GetType()==cmState::MODULE_LIBRARY (target->GetType()==cmState::MODULE_LIBRARY
&& libName != GetVS6TargetName(j->first))) && libName != GetVS6TargetName(j->first)))
{ {
// Compute the proper name to use to link this library. // Compute the proper name to use to link this library.
@ -1195,7 +1188,7 @@ void cmLocalVisualStudio6Generator
std::string extraLinkOptionsRelease; std::string extraLinkOptionsRelease;
std::string extraLinkOptionsMinSizeRel; std::string extraLinkOptionsMinSizeRel;
std::string extraLinkOptionsRelWithDebInfo; std::string extraLinkOptionsRelWithDebInfo;
if(target.GetType() == cmState::EXECUTABLE) if(target->GetType() == cmState::EXECUTABLE)
{ {
extraLinkOptions = this->Makefile-> extraLinkOptions = this->Makefile->
GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS"); GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS");
@ -1208,7 +1201,7 @@ void cmLocalVisualStudio6Generator
extraLinkOptionsRelWithDebInfo = this->Makefile-> extraLinkOptionsRelWithDebInfo = this->Makefile->
GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO"); GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO");
} }
if(target.GetType() == cmState::SHARED_LIBRARY) if(target->GetType() == cmState::SHARED_LIBRARY)
{ {
extraLinkOptions = this->Makefile-> extraLinkOptions = this->Makefile->
GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS"); GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS");
@ -1221,7 +1214,7 @@ void cmLocalVisualStudio6Generator
extraLinkOptionsRelWithDebInfo = this->Makefile-> extraLinkOptionsRelWithDebInfo = this->Makefile->
GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO"); GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO");
} }
if(target.GetType() == cmState::MODULE_LIBRARY) if(target->GetType() == cmState::MODULE_LIBRARY)
{ {
extraLinkOptions = this->Makefile-> extraLinkOptions = this->Makefile->
GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS"); GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS");
@ -1236,63 +1229,61 @@ void cmLocalVisualStudio6Generator
} }
// Get extra linker options for this target. // Get extra linker options for this target.
if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS")) if(const char* targetLinkFlags = target->GetProperty("LINK_FLAGS"))
{ {
extraLinkOptions += " "; extraLinkOptions += " ";
extraLinkOptions += targetLinkFlags; extraLinkOptions += targetLinkFlags;
} }
if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_DEBUG")) if(const char* targetLinkFlags = target->GetProperty("LINK_FLAGS_DEBUG"))
{ {
extraLinkOptionsDebug += " "; extraLinkOptionsDebug += " ";
extraLinkOptionsDebug += targetLinkFlags; extraLinkOptionsDebug += targetLinkFlags;
} }
if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_RELEASE")) if(const char* targetLinkFlags = target->GetProperty("LINK_FLAGS_RELEASE"))
{ {
extraLinkOptionsRelease += " "; extraLinkOptionsRelease += " ";
extraLinkOptionsRelease += targetLinkFlags; extraLinkOptionsRelease += targetLinkFlags;
} }
if(const char* targetLinkFlags = target.GetProperty("LINK_FLAGS_MINSIZEREL")) if(const char* targetLinkFlags =
target->GetProperty("LINK_FLAGS_MINSIZEREL"))
{ {
extraLinkOptionsMinSizeRel += " "; extraLinkOptionsMinSizeRel += " ";
extraLinkOptionsMinSizeRel += targetLinkFlags; extraLinkOptionsMinSizeRel += targetLinkFlags;
} }
if(const char* targetLinkFlags = if(const char* targetLinkFlags =
target.GetProperty("LINK_FLAGS_RELWITHDEBINFO")) target->GetProperty("LINK_FLAGS_RELWITHDEBINFO"))
{ {
extraLinkOptionsRelWithDebInfo += " "; extraLinkOptionsRelWithDebInfo += " ";
extraLinkOptionsRelWithDebInfo += targetLinkFlags; extraLinkOptionsRelWithDebInfo += targetLinkFlags;
} }
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
// Get standard libraries for this language. // Get standard libraries for this language.
if(targetBuilds) if(targetBuilds)
{ {
// Get the language to use for linking. // Get the language to use for linking.
std::vector<std::string> configs; std::vector<std::string> configs;
target.GetMakefile()->GetConfigurations(configs); target->Target->GetMakefile()->GetConfigurations(configs);
std::vector<std::string>::const_iterator it = configs.begin(); std::vector<std::string>::const_iterator it = configs.begin();
const std::string& linkLanguage = gt->GetLinkerLanguage(*it); const std::string& linkLanguage = target->GetLinkerLanguage(*it);
for ( ; it != configs.end(); ++it) for ( ; it != configs.end(); ++it)
{ {
const std::string& configLinkLanguage = gt->GetLinkerLanguage(*it); const std::string& configLinkLanguage = target->GetLinkerLanguage(*it);
if (configLinkLanguage != linkLanguage) if (configLinkLanguage != linkLanguage)
{ {
cmSystemTools::Error cmSystemTools::Error
("Linker language must not vary by configuration for target: ", ("Linker language must not vary by configuration for target: ",
target.GetName().c_str()); target->GetName().c_str());
} }
} }
if(linkLanguage.empty()) if(linkLanguage.empty())
{ {
cmSystemTools::Error cmSystemTools::Error
("CMake can not determine linker language for target: ", ("CMake can not determine linker language for target: ",
target.GetName().c_str()); target->GetName().c_str());
return; return;
} }
@ -1313,13 +1304,13 @@ void cmLocalVisualStudio6Generator
// Compute version number information. // Compute version number information.
std::string targetVersionFlag; std::string targetVersionFlag;
if(target.GetType() == cmState::EXECUTABLE || if(target->GetType() == cmState::EXECUTABLE ||
target.GetType() == cmState::SHARED_LIBRARY || target->GetType() == cmState::SHARED_LIBRARY ||
target.GetType() == cmState::MODULE_LIBRARY) target->GetType() == cmState::MODULE_LIBRARY)
{ {
int major; int major;
int minor; int minor;
gt->GetTargetVersion(major, minor); target->GetTargetVersion(major, minor);
std::ostringstream targetVersionStream; std::ostringstream targetVersionStream;
targetVersionStream << "/version:" << major << "." << minor; targetVersionStream << "/version:" << major << "." << minor;
targetVersionFlag = targetVersionStream.str(); targetVersionFlag = targetVersionStream.str();
@ -1332,20 +1323,20 @@ void cmLocalVisualStudio6Generator
std::string outputNameRelease = outputName; std::string outputNameRelease = outputName;
std::string outputNameMinSizeRel = outputName; std::string outputNameMinSizeRel = outputName;
std::string outputNameRelWithDebInfo = outputName; std::string outputNameRelWithDebInfo = outputName;
if(target.GetType() == cmState::EXECUTABLE || if(target->GetType() == cmState::EXECUTABLE ||
target.GetType() == cmState::STATIC_LIBRARY || target->GetType() == cmState::STATIC_LIBRARY ||
target.GetType() == cmState::SHARED_LIBRARY || target->GetType() == cmState::SHARED_LIBRARY ||
target.GetType() == cmState::MODULE_LIBRARY) target->GetType() == cmState::MODULE_LIBRARY)
{ {
outputName = gt->GetFullName(); outputName = target->GetFullName();
outputNameDebug = gt->GetFullName("Debug"); outputNameDebug = target->GetFullName("Debug");
outputNameRelease = gt->GetFullName("Release"); outputNameRelease = target->GetFullName("Release");
outputNameMinSizeRel = gt->GetFullName("MinSizeRel"); outputNameMinSizeRel = target->GetFullName("MinSizeRel");
outputNameRelWithDebInfo = gt->GetFullName("RelWithDebInfo"); outputNameRelWithDebInfo = target->GetFullName("RelWithDebInfo");
} }
else if(target.GetType() == cmState::OBJECT_LIBRARY) else if(target->GetType() == cmState::OBJECT_LIBRARY)
{ {
outputName = target.GetName(); outputName = target->GetName();
outputName += ".lib"; outputName += ".lib";
outputNameDebug = outputName; outputNameDebug = outputName;
outputNameRelease = outputName; outputNameRelease = outputName;
@ -1359,30 +1350,30 @@ void cmLocalVisualStudio6Generator
std::string outputDirRelease; std::string outputDirRelease;
std::string outputDirMinSizeRel; std::string outputDirMinSizeRel;
std::string outputDirRelWithDebInfo; std::string outputDirRelWithDebInfo;
if(target.GetType() == cmState::EXECUTABLE || if(target->GetType() == cmState::EXECUTABLE ||
target.GetType() == cmState::STATIC_LIBRARY || target->GetType() == cmState::STATIC_LIBRARY ||
target.GetType() == cmState::SHARED_LIBRARY || target->GetType() == cmState::SHARED_LIBRARY ||
target.GetType() == cmState::MODULE_LIBRARY) target->GetType() == cmState::MODULE_LIBRARY)
{ {
#ifdef CM_USE_OLD_VS6 #ifdef CM_USE_OLD_VS6
outputDirOld = outputDirOld =
removeQuotes(this->ConvertToOutputFormat removeQuotes(this->ConvertToOutputFormat
(gt->GetDirectory().c_str(), SHELL)); (target->GetDirectory().c_str(), SHELL));
#endif #endif
outputDirDebug = outputDirDebug =
removeQuotes(this->ConvertToOutputFormat( removeQuotes(this->ConvertToOutputFormat(
gt->GetDirectory("Debug").c_str(), SHELL)); target->GetDirectory("Debug").c_str(), SHELL));
outputDirRelease = outputDirRelease =
removeQuotes(this->ConvertToOutputFormat( removeQuotes(this->ConvertToOutputFormat(
gt->GetDirectory("Release").c_str(), SHELL)); target->GetDirectory("Release").c_str(), SHELL));
outputDirMinSizeRel = outputDirMinSizeRel =
removeQuotes(this->ConvertToOutputFormat( removeQuotes(this->ConvertToOutputFormat(
gt->GetDirectory("MinSizeRel").c_str(), SHELL)); target->GetDirectory("MinSizeRel").c_str(), SHELL));
outputDirRelWithDebInfo = outputDirRelWithDebInfo =
removeQuotes(this->ConvertToOutputFormat( removeQuotes(this->ConvertToOutputFormat(
gt->GetDirectory("RelWithDebInfo").c_str(), SHELL)); target->GetDirectory("RelWithDebInfo").c_str(), SHELL));
} }
else if(target.GetType() == cmState::OBJECT_LIBRARY) else if(target->GetType() == cmState::OBJECT_LIBRARY)
{ {
std::string outputDir = cmake::GetCMakeFilesDirectoryPostSlash(); std::string outputDir = cmake::GetCMakeFilesDirectoryPostSlash();
outputDirDebug = outputDir + "Debug"; outputDirDebug = outputDir + "Debug";
@ -1396,9 +1387,9 @@ void cmLocalVisualStudio6Generator
std::string optionsRelease; std::string optionsRelease;
std::string optionsMinSizeRel; std::string optionsMinSizeRel;
std::string optionsRelWithDebInfo; std::string optionsRelWithDebInfo;
if(target.GetType() == cmState::EXECUTABLE || if(target->GetType() == cmState::EXECUTABLE ||
target.GetType() == cmState::SHARED_LIBRARY || target->GetType() == cmState::SHARED_LIBRARY ||
target.GetType() == cmState::MODULE_LIBRARY) target->GetType() == cmState::MODULE_LIBRARY)
{ {
extraLinkOptionsDebug = extraLinkOptionsDebug =
extraLinkOptions + " " + extraLinkOptionsDebug; extraLinkOptions + " " + extraLinkOptionsDebug;
@ -1424,24 +1415,24 @@ void cmLocalVisualStudio6Generator
std::string targetImplibFlagRelease; std::string targetImplibFlagRelease;
std::string targetImplibFlagMinSizeRel; std::string targetImplibFlagMinSizeRel;
std::string targetImplibFlagRelWithDebInfo; std::string targetImplibFlagRelWithDebInfo;
if(target.GetType() == cmState::SHARED_LIBRARY || if(target->GetType() == cmState::SHARED_LIBRARY ||
target.GetType() == cmState::MODULE_LIBRARY || target->GetType() == cmState::MODULE_LIBRARY ||
target.GetType() == cmState::EXECUTABLE) target->GetType() == cmState::EXECUTABLE)
{ {
std::string fullPathImpDebug = gt->GetDirectory("Debug", true); std::string fullPathImpDebug = target->GetDirectory("Debug", true);
std::string fullPathImpRelease = gt->GetDirectory("Release", true); std::string fullPathImpRelease = target->GetDirectory("Release", true);
std::string fullPathImpMinSizeRel = std::string fullPathImpMinSizeRel =
gt->GetDirectory("MinSizeRel", true); target->GetDirectory("MinSizeRel", true);
std::string fullPathImpRelWithDebInfo = std::string fullPathImpRelWithDebInfo =
gt->GetDirectory("RelWithDebInfo", true); target->GetDirectory("RelWithDebInfo", true);
fullPathImpDebug += "/"; fullPathImpDebug += "/";
fullPathImpRelease += "/"; fullPathImpRelease += "/";
fullPathImpMinSizeRel += "/"; fullPathImpMinSizeRel += "/";
fullPathImpRelWithDebInfo += "/"; fullPathImpRelWithDebInfo += "/";
fullPathImpDebug += gt->GetFullName("Debug", true); fullPathImpDebug += target->GetFullName("Debug", true);
fullPathImpRelease += gt->GetFullName("Release", true); fullPathImpRelease += target->GetFullName("Release", true);
fullPathImpMinSizeRel += gt->GetFullName("MinSizeRel", true); fullPathImpMinSizeRel += target->GetFullName("MinSizeRel", true);
fullPathImpRelWithDebInfo += gt->GetFullName("RelWithDebInfo", true); fullPathImpRelWithDebInfo += target->GetFullName("RelWithDebInfo", true);
targetImplibFlagDebug = "/implib:"; targetImplibFlagDebug = "/implib:";
targetImplibFlagRelease = "/implib:"; targetImplibFlagRelease = "/implib:";
@ -1494,7 +1485,7 @@ void cmLocalVisualStudio6Generator
std::string staticLibOptionsRelease; std::string staticLibOptionsRelease;
std::string staticLibOptionsMinSizeRel; std::string staticLibOptionsMinSizeRel;
std::string staticLibOptionsRelWithDebInfo; std::string staticLibOptionsRelWithDebInfo;
if(target.GetType() == cmState::STATIC_LIBRARY ) if(target->GetType() == cmState::STATIC_LIBRARY )
{ {
const char *libflagsGlobal = const char *libflagsGlobal =
this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS"); this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS");
@ -1513,7 +1504,7 @@ void cmLocalVisualStudio6Generator
this->AppendFlags(staticLibOptionsRelWithDebInfo, this->Makefile-> this->AppendFlags(staticLibOptionsRelWithDebInfo, this->Makefile->
GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO")); GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO"));
const char *libflags = target.GetProperty("STATIC_LIBRARY_FLAGS"); const char *libflags = target->GetProperty("STATIC_LIBRARY_FLAGS");
this->AppendFlags(staticLibOptions, libflags); this->AppendFlags(staticLibOptions, libflags);
this->AppendFlags(staticLibOptionsDebug, libflags); this->AppendFlags(staticLibOptionsDebug, libflags);
this->AppendFlags(staticLibOptionsRelease, libflags); this->AppendFlags(staticLibOptionsRelease, libflags);
@ -1521,13 +1512,13 @@ void cmLocalVisualStudio6Generator
this->AppendFlags(staticLibOptionsRelWithDebInfo, libflags); this->AppendFlags(staticLibOptionsRelWithDebInfo, libflags);
this->AppendFlags(staticLibOptionsDebug, this->AppendFlags(staticLibOptionsDebug,
target.GetProperty("STATIC_LIBRARY_FLAGS_DEBUG")); target->GetProperty("STATIC_LIBRARY_FLAGS_DEBUG"));
this->AppendFlags(staticLibOptionsRelease, this->AppendFlags(staticLibOptionsRelease,
target.GetProperty("STATIC_LIBRARY_FLAGS_RELEASE")); target->GetProperty("STATIC_LIBRARY_FLAGS_RELEASE"));
this->AppendFlags(staticLibOptionsMinSizeRel, this->AppendFlags(staticLibOptionsMinSizeRel,
target.GetProperty("STATIC_LIBRARY_FLAGS_MINSIZEREL")); target->GetProperty("STATIC_LIBRARY_FLAGS_MINSIZEREL"));
this->AppendFlags(staticLibOptionsRelWithDebInfo, this->AppendFlags(staticLibOptionsRelWithDebInfo,
target.GetProperty("STATIC_LIBRARY_FLAGS_RELWITHDEBINFO")); target->GetProperty("STATIC_LIBRARY_FLAGS_RELWITHDEBINFO"));
std::string objects; std::string objects;
this->OutputObjects(target, "LIB", objects); this->OutputObjects(target, "LIB", objects);
@ -1543,7 +1534,7 @@ void cmLocalVisualStudio6Generator
// Add the export symbol definition for shared library objects. // Add the export symbol definition for shared library objects.
std::string exportSymbol; std::string exportSymbol;
if(const char* exportMacro = gt->GetExportMacro()) if(const char* exportMacro = target->GetExportMacro())
{ {
exportSymbol = exportMacro; exportSymbol = exportMacro;
} }
@ -1567,8 +1558,8 @@ void cmLocalVisualStudio6Generator
libnameExports.c_str()); libnameExports.c_str());
cmSystemTools::ReplaceString(line, "CMAKE_MFC_FLAG", cmSystemTools::ReplaceString(line, "CMAKE_MFC_FLAG",
mfcFlag); mfcFlag);
if(target.GetType() == cmState::STATIC_LIBRARY || if(target->GetType() == cmState::STATIC_LIBRARY ||
target.GetType() == cmState::OBJECT_LIBRARY) target->GetType() == cmState::OBJECT_LIBRARY)
{ {
cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_DEBUG", cmSystemTools::ReplaceString(line, "CM_STATIC_LIB_ARGS_DEBUG",
staticLibOptionsDebug.c_str()); staticLibOptionsDebug.c_str());
@ -1674,7 +1665,7 @@ void cmLocalVisualStudio6Generator
(exePath.c_str(), SHELL)).c_str()); (exePath.c_str(), SHELL)).c_str());
#endif #endif
if(targetBuilds || target.GetType() == cmState::OBJECT_LIBRARY) if(targetBuilds || target->GetType() == cmState::OBJECT_LIBRARY)
{ {
cmSystemTools::ReplaceString(line, "OUTPUT_DIRECTORY_DEBUG", cmSystemTools::ReplaceString(line, "OUTPUT_DIRECTORY_DEBUG",
outputDirDebug.c_str()); outputDirDebug.c_str());
@ -1698,8 +1689,8 @@ void cmLocalVisualStudio6Generator
= this->Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX"); = this->Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX");
cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX", cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX",
debugPostfix?debugPostfix:""); debugPostfix?debugPostfix:"");
if(target.GetType() >= cmState::EXECUTABLE && if(target->GetType() >= cmState::EXECUTABLE &&
target.GetType() <= cmState::OBJECT_LIBRARY) target->GetType() <= cmState::OBJECT_LIBRARY)
{ {
// store flags for each configuration // store flags for each configuration
std::string flags = " "; std::string flags = " ";
@ -1708,24 +1699,24 @@ void cmLocalVisualStudio6Generator
std::string flagsDebug = " "; std::string flagsDebug = " ";
std::string flagsRelWithDebInfo = " "; std::string flagsRelWithDebInfo = " ";
std::vector<std::string> configs; std::vector<std::string> configs;
target.GetMakefile()->GetConfigurations(configs); target->Target->GetMakefile()->GetConfigurations(configs);
std::vector<std::string>::const_iterator it = configs.begin(); std::vector<std::string>::const_iterator it = configs.begin();
const std::string& linkLanguage = gt->GetLinkerLanguage(*it); const std::string& linkLanguage = target->GetLinkerLanguage(*it);
for ( ; it != configs.end(); ++it) for ( ; it != configs.end(); ++it)
{ {
const std::string& configLinkLanguage = gt->GetLinkerLanguage(*it); const std::string& configLinkLanguage = target->GetLinkerLanguage(*it);
if (configLinkLanguage != linkLanguage) if (configLinkLanguage != linkLanguage)
{ {
cmSystemTools::Error cmSystemTools::Error
("Linker language must not vary by configuration for target: ", ("Linker language must not vary by configuration for target: ",
target.GetName().c_str()); target->GetName().c_str());
} }
} }
if(linkLanguage.empty()) if(linkLanguage.empty())
{ {
cmSystemTools::Error cmSystemTools::Error
("CMake can not determine linker language for target: ", ("CMake can not determine linker language for target: ",
target.GetName().c_str()); target->GetName().c_str());
return; return;
} }
// if CXX is on and the target contains cxx code then add the cxx flags // if CXX is on and the target contains cxx code then add the cxx flags
@ -1750,12 +1741,12 @@ void cmLocalVisualStudio6Generator
flagsRelWithDebInfo = this->Makefile->GetSafeDefinition(flagVar.c_str()); flagsRelWithDebInfo = this->Makefile->GetSafeDefinition(flagVar.c_str());
flagsRelWithDebInfo += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" "; flagsRelWithDebInfo += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" ";
this->AddCompileOptions(flags, gt, linkLanguage, ""); this->AddCompileOptions(flags, target, linkLanguage, "");
this->AddCompileOptions(flagsDebug, gt, linkLanguage, "Debug"); this->AddCompileOptions(flagsDebug, target, linkLanguage, "Debug");
this->AddCompileOptions(flagsRelease, gt, linkLanguage, "Release"); this->AddCompileOptions(flagsRelease, target, linkLanguage, "Release");
this->AddCompileOptions(flagsMinSizeRel, gt, linkLanguage, this->AddCompileOptions(flagsMinSizeRel, target, linkLanguage,
"MinSizeRel"); "MinSizeRel");
this->AddCompileOptions(flagsRelWithDebInfo, gt, linkLanguage, this->AddCompileOptions(flagsRelWithDebInfo, target, linkLanguage,
"RelWithDebInfo"); "RelWithDebInfo");
// if _UNICODE and _SBCS are not found, then add -D_MBCS // if _UNICODE and _SBCS are not found, then add -D_MBCS
@ -1775,14 +1766,14 @@ void cmLocalVisualStudio6Generator
std::set<std::string> minsizeDefinesSet; std::set<std::string> minsizeDefinesSet;
std::set<std::string> debugrelDefinesSet; std::set<std::string> debugrelDefinesSet;
this->AddCompileDefinitions(definesSet, gt, "", linkLanguage); this->AddCompileDefinitions(definesSet, target, "", linkLanguage);
this->AddCompileDefinitions(debugDefinesSet, gt, this->AddCompileDefinitions(debugDefinesSet, target,
"DEBUG", linkLanguage); "DEBUG", linkLanguage);
this->AddCompileDefinitions(releaseDefinesSet, gt, this->AddCompileDefinitions(releaseDefinesSet, target,
"RELEASE", linkLanguage); "RELEASE", linkLanguage);
this->AddCompileDefinitions(minsizeDefinesSet, gt, this->AddCompileDefinitions(minsizeDefinesSet, target,
"MINSIZEREL", linkLanguage); "MINSIZEREL", linkLanguage);
this->AddCompileDefinitions(debugrelDefinesSet, gt, this->AddCompileDefinitions(debugrelDefinesSet, target,
"RELWITHDEBINFO", linkLanguage); "RELWITHDEBINFO", linkLanguage);
std::string defines = " "; std::string defines = " ";
@ -1850,15 +1841,13 @@ void cmLocalVisualStudio6Generator::WriteDSPFooter(std::ostream& fout)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalVisualStudio6Generator void cmLocalVisualStudio6Generator
::ComputeLinkOptions(cmTarget& target, ::ComputeLinkOptions(cmGeneratorTarget *target,
const std::string& configName, const std::string& configName,
const std::string extraOptions, const std::string extraOptions,
std::string& options) std::string& options)
{ {
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
// Compute the link information for this configuration. // Compute the link information for this configuration.
cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); cmComputeLinkInformation* pcli = target->GetLinkInformation(configName);
if(!pcli) if(!pcli)
{ {
return; return;
@ -1917,15 +1906,13 @@ void cmLocalVisualStudio6Generator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalVisualStudio6Generator void cmLocalVisualStudio6Generator
::OutputObjects(cmTarget& target, const char* tool, ::OutputObjects(cmGeneratorTarget* target, const char* tool,
std::string& options) std::string& options)
{ {
// VS 6 does not support per-config source locations so we // VS 6 does not support per-config source locations so we
// list object library content on the link line instead. // list object library content on the link line instead.
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
std::vector<std::string> objs; std::vector<std::string> objs;
gt->UseObjectLibraries(objs, ""); target->UseObjectLibraries(objs, "");
for(std::vector<std::string>::const_iterator for(std::vector<std::string>::const_iterator
oi = objs.begin(); oi != objs.end(); ++oi) oi = objs.begin(); oi != objs.end(); ++oi)
{ {
@ -1948,7 +1935,7 @@ cmLocalVisualStudio6Generator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmLocalVisualStudio6Generator cmLocalVisualStudio6Generator
::ComputeLongestObjectDirectory(cmTarget&) const ::ComputeLongestObjectDirectory(cmGeneratorTarget const*) const
{ {
// Compute the maximum length configuration name. // Compute the maximum length configuration name.
std::string config_max; std::string config_max;

View File

@ -14,7 +14,6 @@
#include "cmLocalVisualStudioGenerator.h" #include "cmLocalVisualStudioGenerator.h"
class cmTarget;
class cmSourceFile; class cmSourceFile;
class cmSourceGroup; class cmSourceGroup;
class cmCustomCommand; class cmCustomCommand;
@ -47,50 +46,52 @@ public:
/** /**
* Specify the type of the build: static, dll, or executable. * Specify the type of the build: static, dll, or executable.
*/ */
void SetBuildType(BuildType, const std::string& libName, cmTarget&); void SetBuildType(BuildType, const std::string& libName, cmGeneratorTarget*);
virtual virtual
std::string GetTargetDirectory(cmGeneratorTarget const* target) const; std::string GetTargetDirectory(cmGeneratorTarget const* target) const;
virtual std::string ComputeLongestObjectDirectory(cmTarget&) const; virtual std::string
ComputeLongestObjectDirectory(cmGeneratorTarget const*) const;
private: private:
std::string DSPHeaderTemplate; std::string DSPHeaderTemplate;
std::string DSPFooterTemplate; std::string DSPFooterTemplate;
void CreateSingleDSP(const std::string& lname, cmTarget &tgt); void CreateSingleDSP(const std::string& lname, cmGeneratorTarget* tgt);
void WriteDSPFile(std::ostream& fout, const std::string& libName, void WriteDSPFile(std::ostream& fout, const std::string& libName,
cmTarget &tgt); cmGeneratorTarget* tgt);
void WriteDSPBeginGroup(std::ostream& fout, void WriteDSPBeginGroup(std::ostream& fout,
const char* group, const char* group,
const char* filter); const char* filter);
void WriteDSPEndGroup(std::ostream& fout); void WriteDSPEndGroup(std::ostream& fout);
void WriteDSPHeader(std::ostream& fout, const std::string& libName, void WriteDSPHeader(std::ostream& fout, const std::string& libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs); cmGeneratorTarget* tgt, std::vector<cmSourceGroup> &sgs);
void WriteDSPFooter(std::ostream& fout); void WriteDSPFooter(std::ostream& fout);
void AddDSPBuildRule(cmTarget& tgt); void AddDSPBuildRule(cmGeneratorTarget* tgt);
void WriteCustomRule(std::ostream& fout, void WriteCustomRule(std::ostream& fout,
const char* source, const char* source,
const cmCustomCommand& command, const cmCustomCommand& command,
const char* flags); const char* flags);
void AddUtilityCommandHack(cmTarget& target, int count, void AddUtilityCommandHack(cmGeneratorTarget* target, int count,
std::vector<std::string>& depends, std::vector<std::string>& depends,
const cmCustomCommand& origCommand); const cmCustomCommand& origCommand);
void WriteGroup(const cmSourceGroup *sg, cmTarget& target, void WriteGroup(const cmSourceGroup *sg, cmGeneratorTarget* target,
std::ostream &fout, const std::string& libName); std::ostream &fout, const std::string& libName);
class EventWriter; class EventWriter;
friend class EventWriter; friend class EventWriter;
cmsys::auto_ptr<cmCustomCommand> cmsys::auto_ptr<cmCustomCommand>
MaybeCreateOutputDir(cmTarget& target, const std::string& config); MaybeCreateOutputDir(cmGeneratorTarget *target, const std::string& config);
std::string CreateTargetRules(cmTarget &target, std::string CreateTargetRules(cmGeneratorTarget* target,
const std::string& configName, const std::string& configName,
const std::string& libName); const std::string& libName);
void ComputeLinkOptions(cmTarget& target, const std::string& configName, void ComputeLinkOptions(cmGeneratorTarget* target,
const std::string& configName,
const std::string extraOptions, const std::string extraOptions,
std::string& options); std::string& options);
void OutputObjects(cmTarget& target, const char* tool, void OutputObjects(cmGeneratorTarget* target, const char* tool,
std::string& options); std::string& options);
std::string GetTargetIncludeOptions(cmTarget &target, std::string GetTargetIncludeOptions(cmGeneratorTarget* target,
const std::string& config); const std::string& config);
std::vector<std::string> Configurations; std::vector<std::string> Configurations;

View File

@ -34,7 +34,8 @@ public:
LocalGenerator(e) {} LocalGenerator(e) {}
typedef cmComputeLinkInformation::ItemVector ItemVector; typedef cmComputeLinkInformation::ItemVector ItemVector;
void OutputLibraries(std::ostream& fout, ItemVector const& libs); void OutputLibraries(std::ostream& fout, ItemVector const& libs);
void OutputObjects(std::ostream& fout, cmTarget* t, const char* isep = 0); void OutputObjects(std::ostream& fout, cmGeneratorTarget* t,
const char* isep = 0);
private: private:
cmLocalVisualStudio7Generator* LocalGenerator; cmLocalVisualStudio7Generator* LocalGenerator;
}; };
@ -67,19 +68,19 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
void cmLocalVisualStudio7Generator::AddHelperCommands() void cmLocalVisualStudio7Generator::AddHelperCommands()
{ {
// Now create GUIDs for targets // Now create GUIDs for targets
cmTargets &tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) l != tgts.end(); ++l)
{ {
if(l->second.GetType() == cmState::INTERFACE_LIBRARY) if((*l)->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
const char* path = l->second.GetProperty("EXTERNAL_MSPROJECT"); const char* path = (*l)->GetProperty("EXTERNAL_MSPROJECT");
if(path) if(path)
{ {
this->ReadAndStoreExternalGUID( this->ReadAndStoreExternalGUID(
l->second.GetName().c_str(), path); (*l)->GetName().c_str(), path);
} }
} }
@ -95,7 +96,6 @@ void cmLocalVisualStudio7Generator::Generate()
void cmLocalVisualStudio7Generator::AddCMakeListsRules() void cmLocalVisualStudio7Generator::AddCMakeListsRules()
{ {
cmTargets &tgts = this->Makefile->GetTargets();
// Create the regeneration custom rule. // Create the regeneration custom rule.
if(!this->Makefile->IsOn("CMAKE_SUPPRESS_REGENERATION")) if(!this->Makefile->IsOn("CMAKE_SUPPRESS_REGENERATION"))
{ {
@ -104,17 +104,17 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules()
if(cmSourceFile* sf = this->CreateVCProjBuildRule()) if(cmSourceFile* sf = this->CreateVCProjBuildRule())
{ {
// Add the rule to targets that need it. // Add the rule to targets that need it.
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l)
{ {
if (l->second.GetType() == cmState::GLOBAL_TARGET) if ((*l)->GetType() == cmState::GLOBAL_TARGET)
{ {
continue; continue;
} }
if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET) if((*l)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
{ {
cmGeneratorTarget* gt = (*l)->AddSource(sf->GetFullPath());
this->GlobalGenerator->GetGeneratorTarget(&l->second);
gt->AddSource(sf->GetFullPath());
} }
} }
} }
@ -126,12 +126,11 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
// Visual Studio .NET 2003 Service Pack 1 will not run post-build // Visual Studio .NET 2003 Service Pack 1 will not run post-build
// commands for targets in which no sources are built. Add dummy // commands for targets in which no sources are built. Add dummy
// rules to force these targets to build. // rules to force these targets to build.
cmTargets &tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(cmTargets::iterator l = tgts.begin(); for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++) l != tgts.end(); l++)
{ {
cmTarget& tgt = l->second; if((*l)->GetType() == cmState::GLOBAL_TARGET)
if(tgt.GetType() == cmState::GLOBAL_TARGET)
{ {
std::vector<std::string> no_depends; std::vector<std::string> no_depends;
cmCustomCommandLine force_command; cmCustomCommandLine force_command;
@ -143,16 +142,14 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
std::string force = this->GetCurrentBinaryDirectory(); std::string force = this->GetCurrentBinaryDirectory();
force += cmake::GetCMakeFilesDirectory(); force += cmake::GetCMakeFilesDirectory();
force += "/"; force += "/";
force += tgt.GetName(); force += (*l)->GetName();
force += "_force"; force += "_force";
if(cmSourceFile* file = if(cmSourceFile* file =
this->Makefile->AddCustomCommandToOutput( this->Makefile->AddCustomCommandToOutput(
force.c_str(), no_depends, no_main_dependency, force.c_str(), no_depends, no_main_dependency,
force_commands, " ", 0, true)) force_commands, " ", 0, true))
{ {
cmGeneratorTarget* gt = (*l)->AddSource(file->GetFullPath());
this->GlobalGenerator->GetGeneratorTarget(&tgt);
gt->AddSource(file->GetFullPath());
} }
} }
} }
@ -176,21 +173,21 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
} }
// Get the set of targets in this directory. // Get the set of targets in this directory.
cmTargets &tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
// Create the project file for each target. // Create the project file for each target.
for(cmTargets::iterator l = tgts.begin(); for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++) l != tgts.end(); l++)
{ {
if(l->second.GetType() == cmState::INTERFACE_LIBRARY) if((*l)->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
// INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
// so don't build a projectfile for it // so don't build a projectfile for it
if(!l->second.GetProperty("EXTERNAL_MSPROJECT")) if(!(*l)->GetProperty("EXTERNAL_MSPROJECT"))
{ {
this->CreateSingleVCProj(l->first.c_str(),l->second); this->CreateSingleVCProj((*l)->GetName().c_str(), *l);
} }
} }
} }
@ -228,7 +225,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalVisualStudio7Generator void cmLocalVisualStudio7Generator
::CreateSingleVCProj(const std::string& lname, cmTarget &target) ::CreateSingleVCProj(const std::string& lname, cmGeneratorTarget *target)
{ {
cmGlobalVisualStudioGenerator* gg cmGlobalVisualStudioGenerator* gg
= static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator); = static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator);
@ -244,7 +241,7 @@ void cmLocalVisualStudio7Generator
} }
// add to the list of projects // add to the list of projects
target.SetProperty("GENERATOR_FILE_NAME",lname.c_str()); target->Target->SetProperty("GENERATOR_FILE_NAME",lname.c_str());
// create the dsp.cmake file // create the dsp.cmake file
std::string fname; std::string fname;
fname = this->GetCurrentBinaryDirectory(); fname = this->GetCurrentBinaryDirectory();
@ -327,8 +324,9 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
} }
void cmLocalVisualStudio7Generator::WriteConfigurations( void cmLocalVisualStudio7Generator::WriteConfigurations(
std::ostream& fout, std::vector<std::string> const& configs, std::ostream& fout,
const std::string& libName, cmTarget &target std::vector<std::string> const& configs,
const std::string& libName, cmGeneratorTarget *target
) )
{ {
fout << "\t<Configurations>\n"; fout << "\t<Configurations>\n";
@ -646,7 +644,7 @@ private:
void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
const std::string& configName, const std::string& configName,
const std::string& libName, const std::string& libName,
cmTarget &target) cmGeneratorTarget *target)
{ {
const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG"); const char* mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG");
if(!mfcFlag) if(!mfcFlag)
@ -667,10 +665,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
const char* projectType = 0; const char* projectType = 0;
bool targetBuilds = true; bool targetBuilds = true;
cmGeneratorTarget* gt = switch(target->GetType())
this->GlobalGenerator->GetGeneratorTarget(&target);
switch(target.GetType())
{ {
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
targetBuilds = false; // no manifest tool for object library targetBuilds = false; // no manifest tool for object library
@ -702,12 +697,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
{ {
const std::string& linkLanguage = (this->FortranProject? const std::string& linkLanguage = (this->FortranProject?
std::string("Fortran"): std::string("Fortran"):
gt->GetLinkerLanguage(configName)); target->GetLinkerLanguage(configName));
if(linkLanguage.empty()) if(linkLanguage.empty())
{ {
cmSystemTools::Error cmSystemTools::Error
("CMake can not determine linker language for target: ", ("CMake can not determine linker language for target: ",
target.GetName().c_str()); target->GetName().c_str());
return; return;
} }
if(linkLanguage == "C" || linkLanguage == "CXX" if(linkLanguage == "C" || linkLanguage == "CXX"
@ -733,12 +728,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
} }
// Add the target-specific flags. // Add the target-specific flags.
this->AddCompileOptions(flags, gt, linkLanguage, configName); this->AddCompileOptions(flags, target, linkLanguage, configName);
} }
if(this->FortranProject) if(this->FortranProject)
{ {
switch(this->GetFortranFormat(target.GetProperty("Fortran_FORMAT"))) switch(this->GetFortranFormat(target->GetProperty("Fortran_FORMAT")))
{ {
case FortranFormatFixed: flags += " -fixed"; break; case FortranFormatFixed: flags += " -fixed"; break;
case FortranFormatFree: flags += " -free"; break; case FortranFormatFree: flags += " -free"; break;
@ -765,7 +760,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.Parse(defineFlags.c_str()); targetOptions.Parse(defineFlags.c_str());
targetOptions.ParseFinish(); targetOptions.ParseFinish();
std::vector<std::string> targetDefines; std::vector<std::string> targetDefines;
gt->GetCompileDefinitions(targetDefines, configName, "CXX"); target->GetCompileDefinitions(targetDefines, configName, "CXX");
targetOptions.AddDefines(targetDefines); targetOptions.AddDefines(targetDefines);
targetOptions.SetVerboseMakefile( targetOptions.SetVerboseMakefile(
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
@ -777,22 +772,22 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.AddDefine(configDefine); targetOptions.AddDefine(configDefine);
// Add the export symbol definition for shared library objects. // Add the export symbol definition for shared library objects.
if(const char* exportMacro = gt->GetExportMacro()) if(const char* exportMacro = target->GetExportMacro())
{ {
targetOptions.AddDefine(exportMacro); targetOptions.AddDefine(exportMacro);
} }
// The intermediate directory name consists of a directory for the // The intermediate directory name consists of a directory for the
// target and a subdirectory for the configuration name. // target and a subdirectory for the configuration name.
std::string intermediateDir = this->GetTargetDirectory(gt); std::string intermediateDir = this->GetTargetDirectory(target);
intermediateDir += "/"; intermediateDir += "/";
intermediateDir += configName; intermediateDir += configName;
if (target.GetType() < cmState::UTILITY) if (target->Target->GetType() < cmState::UTILITY)
{ {
std::string const& outDir = std::string const& outDir =
target.GetType() == cmState::OBJECT_LIBRARY? target->Target->GetType() == cmState::OBJECT_LIBRARY?
intermediateDir : gt->GetDirectory(configName); intermediateDir : target->GetDirectory(configName);
fout << "\t\t\tOutputDirectory=\"" fout << "\t\t\tOutputDirectory=\""
<< this->ConvertToXMLOutputPathSingle(outDir.c_str()) << "\"\n"; << this->ConvertToXMLOutputPathSingle(outDir.c_str()) << "\"\n";
} }
@ -807,7 +802,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
if (this->FortranProject) if (this->FortranProject)
{ {
// Intel Fortran >= 15.0 uses TargetName property. // Intel Fortran >= 15.0 uses TargetName property.
std::string targetNameFull = gt->GetFullName(configName); std::string targetNameFull = target->GetFullName(configName);
std::string targetName = std::string targetName =
cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull); cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull);
std::string targetExt = std::string targetExt =
@ -842,7 +837,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
if(this->FortranProject) if(this->FortranProject)
{ {
const char* target_mod_dir = const char* target_mod_dir =
target.GetProperty("Fortran_MODULE_DIRECTORY"); target->Target->GetProperty("Fortran_MODULE_DIRECTORY");
std::string modDir; std::string modDir;
if(target_mod_dir) if(target_mod_dir)
{ {
@ -861,7 +856,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
fout << "\t\t\t\tAdditionalIncludeDirectories=\""; fout << "\t\t\t\tAdditionalIncludeDirectories=\"";
std::vector<std::string> includes; std::vector<std::string> includes;
this->GetIncludeDirectories(includes, gt, "C", configName); this->GetIncludeDirectories(includes, target, "C", configName);
std::vector<std::string>::iterator i = includes.begin(); std::vector<std::string>::iterator i = includes.begin();
for(;i != includes.end(); ++i) for(;i != includes.end(); ++i)
{ {
@ -882,10 +877,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.OutputFlagMap(fout, "\t\t\t\t"); targetOptions.OutputFlagMap(fout, "\t\t\t\t");
targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", "CXX"); targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", "CXX");
fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"; fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n";
if(target.GetType() <= cmState::OBJECT_LIBRARY) if(target->Target->GetType() <= cmState::OBJECT_LIBRARY)
{ {
// Specify the compiler program database file if configured. // Specify the compiler program database file if configured.
std::string pdb = gt->GetCompilePDBPath(configName); std::string pdb = target->GetCompilePDBPath(configName);
if(!pdb.empty()) if(!pdb.empty())
{ {
fout << "\t\t\t\tProgramDataBaseFileName=\"" fout << "\t\t\t\tProgramDataBaseFileName=\""
@ -989,7 +984,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
"\t\t\t\tName=\"" << manifestTool << "\""; "\t\t\t\tName=\"" << manifestTool << "\"";
std::vector<cmSourceFile const*> manifest_srcs; std::vector<cmSourceFile const*> manifest_srcs;
gt->GetManifests(manifest_srcs, configName); target->GetManifests(manifest_srcs, configName);
if (!manifest_srcs.empty()) if (!manifest_srcs.empty())
{ {
fout << "\n\t\t\t\tAdditionalManifestFiles=\""; fout << "\n\t\t\t\tAdditionalManifestFiles=\"";
@ -1004,7 +999,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
// Check if we need the FAT32 workaround. // Check if we need the FAT32 workaround.
// Check the filesystem type where the target will be written. // Check the filesystem type where the target will be written.
if (cmLVS6G_IsFAT(gt->GetDirectory(configName).c_str())) if (cmLVS6G_IsFAT(target->GetDirectory(configName).c_str()))
{ {
// Add a flag telling the manifest tool to use a workaround // Add a flag telling the manifest tool to use a workaround
// for FAT32 file systems, which can cause an empty manifest // for FAT32 file systems, which can cause an empty manifest
@ -1038,28 +1033,28 @@ cmLocalVisualStudio7Generator
} }
void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
const std::string& configName, cmTarget &target, const std::string& configName, cmGeneratorTarget* target,
const Options& targetOptions) const Options& targetOptions)
{ {
cmGlobalVisualStudio7Generator* gg = cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator); static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
std::string temp; std::string temp;
std::string extraLinkOptions; std::string extraLinkOptions;
if(target.GetType() == cmState::EXECUTABLE) if(target->GetType() == cmState::EXECUTABLE)
{ {
extraLinkOptions = extraLinkOptions =
this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS") this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS")
+ std::string(" ") + std::string(" ")
+ GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName); + GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName);
} }
if(target.GetType() == cmState::SHARED_LIBRARY) if(target->GetType() == cmState::SHARED_LIBRARY)
{ {
extraLinkOptions = extraLinkOptions =
this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS") this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS")
+ std::string(" ") + std::string(" ")
+ GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName); + GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName);
} }
if(target.GetType() == cmState::MODULE_LIBRARY) if(target->GetType() == cmState::MODULE_LIBRARY)
{ {
extraLinkOptions = extraLinkOptions =
this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS") this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS")
@ -1067,7 +1062,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
+ GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName); + GetBuildTypeLinkerFlags("CMAKE_MODULE_LINKER_FLAGS", configName);
} }
const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); const char* targetLinkFlags = target->GetProperty("LINK_FLAGS");
if(targetLinkFlags) if(targetLinkFlags)
{ {
extraLinkOptions += " "; extraLinkOptions += " ";
@ -1076,7 +1071,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
std::string configTypeUpper = cmSystemTools::UpperCase(configName); std::string configTypeUpper = cmSystemTools::UpperCase(configName);
std::string linkFlagsConfig = "LINK_FLAGS_"; std::string linkFlagsConfig = "LINK_FLAGS_";
linkFlagsConfig += configTypeUpper; linkFlagsConfig += configTypeUpper;
targetLinkFlags = target.GetProperty(linkFlagsConfig.c_str()); targetLinkFlags = target->GetProperty(linkFlagsConfig.c_str());
if(targetLinkFlags) if(targetLinkFlags)
{ {
extraLinkOptions += " "; extraLinkOptions += " ";
@ -1096,28 +1091,26 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
this->ConvertToOutputFormat(this->ModuleDefinitionFile, SHELL); this->ConvertToOutputFormat(this->ModuleDefinitionFile, SHELL);
linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str()); linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str());
} }
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
if (target.GetType() == cmState::SHARED_LIBRARY && if (target->GetType() == cmState::SHARED_LIBRARY &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
if (target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) if (target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)/exportall.def"); linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)/exportall.def");
} }
} }
switch(target.GetType()) switch(target->GetType())
{ {
case cmState::UNKNOWN_LIBRARY: case cmState::UNKNOWN_LIBRARY:
break; break;
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
{ {
std::string libpath = this->GetTargetDirectory(gt); std::string libpath = this->GetTargetDirectory(target);
libpath += "/"; libpath += "/";
libpath += configName; libpath += configName;
libpath += "/"; libpath += "/";
libpath += target.GetName(); libpath += target->GetName();
libpath += ".lib"; libpath += ".lib";
const char* tool = const char* tool =
this->FortranProject? "VFLibrarianTool":"VCLibrarianTool"; this->FortranProject? "VFLibrarianTool":"VCLibrarianTool";
@ -1129,8 +1122,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
} }
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
{ {
std::string targetNameFull = gt->GetFullName(configName); std::string targetNameFull = target->GetFullName(configName);
std::string libpath = gt->GetDirectory(configName); std::string libpath = target->GetDirectory(configName);
libpath += "/"; libpath += "/";
libpath += targetNameFull; libpath += targetNameFull;
const char* tool = "VCLibrarianTool"; const char* tool = "VCLibrarianTool";
@ -1145,14 +1138,14 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
|| this->FortranProject) || this->FortranProject)
{ {
std::ostringstream libdeps; std::ostringstream libdeps;
this->Internal->OutputObjects(libdeps, &target); this->Internal->OutputObjects(libdeps, target);
if(!libdeps.str().empty()) if(!libdeps.str().empty())
{ {
fout << "\t\t\t\tAdditionalDependencies=\"" << libdeps.str() << "\"\n"; fout << "\t\t\t\tAdditionalDependencies=\"" << libdeps.str() << "\"\n";
} }
} }
std::string libflags; std::string libflags;
this->GetStaticLibraryFlags(libflags, configTypeUpper, gt); this->GetStaticLibraryFlags(libflags, configTypeUpper, target);
if(!libflags.empty()) if(!libflags.empty())
{ {
fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n"; fout << "\t\t\t\tAdditionalOptions=\"" << libflags << "\"\n";
@ -1169,11 +1162,11 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
std::string targetNameFull; std::string targetNameFull;
std::string targetNameImport; std::string targetNameImport;
std::string targetNamePDB; std::string targetNamePDB;
gt->GetLibraryNames(targetName, targetNameSO, targetNameFull, target->GetLibraryNames(targetName, targetNameSO, targetNameFull,
targetNameImport, targetNamePDB, configName); targetNameImport, targetNamePDB, configName);
// Compute the link library and directory information. // Compute the link library and directory information.
cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); cmComputeLinkInformation* pcli = target->GetLinkInformation(configName);
if(!pcli) if(!pcli)
{ {
return; return;
@ -1205,22 +1198,22 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
if(this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 if(this->GetVersion() < cmGlobalVisualStudioGenerator::VS8
|| this->FortranProject) || this->FortranProject)
{ {
this->Internal->OutputObjects(fout, &target, " "); this->Internal->OutputObjects(fout, target, " ");
} }
fout << " "; fout << " ";
this->Internal->OutputLibraries(fout, cli.GetItems()); this->Internal->OutputLibraries(fout, cli.GetItems());
fout << "\"\n"; fout << "\"\n";
temp = gt->GetDirectory(configName); temp = target->GetDirectory(configName);
temp += "/"; temp += "/";
temp += targetNameFull; temp += targetNameFull;
fout << "\t\t\t\tOutputFile=\"" fout << "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
this->WriteTargetVersionAttribute(fout, gt); this->WriteTargetVersionAttribute(fout, target);
linkOptions.OutputFlagMap(fout, "\t\t\t\t"); linkOptions.OutputFlagMap(fout, "\t\t\t\t");
fout << "\t\t\t\tAdditionalLibraryDirectories=\""; fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, cli.GetDirectories()); this->OutputLibraryDirectories(fout, cli.GetDirectories());
fout << "\"\n"; fout << "\"\n";
temp = gt->GetPDBDirectory(configName); temp = target->GetPDBDirectory(configName);
temp += "/"; temp += "/";
temp += targetNamePDB; temp += targetNamePDB;
fout << "\t\t\t\tProgramDatabaseFile=\"" << fout << "\t\t\t\tProgramDatabaseFile=\"" <<
@ -1248,7 +1241,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
{ {
fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"\n"; fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"\n";
} }
temp = gt->GetDirectory(configName, true); temp = target->GetDirectory(configName, true);
temp += "/"; temp += "/";
temp += targetNameImport; temp += targetNameImport;
fout << "\t\t\t\tImportLibrary=\"" fout << "\t\t\t\tImportLibrary=\""
@ -1266,11 +1259,11 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
std::string targetNameFull; std::string targetNameFull;
std::string targetNameImport; std::string targetNameImport;
std::string targetNamePDB; std::string targetNamePDB;
gt->GetExecutableNames(targetName, targetNameFull, target->GetExecutableNames(targetName, targetNameFull,
targetNameImport, targetNamePDB, configName); targetNameImport, targetNamePDB, configName);
// Compute the link library and directory information. // Compute the link library and directory information.
cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); cmComputeLinkInformation* pcli = target->GetLinkInformation(configName);
if(!pcli) if(!pcli)
{ {
return; return;
@ -1278,7 +1271,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
cmComputeLinkInformation& cli = *pcli; cmComputeLinkInformation& cli = *pcli;
std::string linkLanguage = cli.GetLinkLanguage(); std::string linkLanguage = cli.GetLinkLanguage();
bool isWin32Executable = target.GetPropertyAsBool("WIN32_EXECUTABLE"); bool isWin32Executable = target->GetPropertyAsBool("WIN32_EXECUTABLE");
// Compute the variable name to lookup standard libraries for this // Compute the variable name to lookup standard libraries for this
// language. // language.
@ -1304,23 +1297,23 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
if(this->GetVersion() < cmGlobalVisualStudioGenerator::VS8 if(this->GetVersion() < cmGlobalVisualStudioGenerator::VS8
|| this->FortranProject) || this->FortranProject)
{ {
this->Internal->OutputObjects(fout, &target, " "); this->Internal->OutputObjects(fout, target, " ");
} }
fout << " "; fout << " ";
this->Internal->OutputLibraries(fout, cli.GetItems()); this->Internal->OutputLibraries(fout, cli.GetItems());
fout << "\"\n"; fout << "\"\n";
temp = gt->GetDirectory(configName); temp = target->GetDirectory(configName);
temp += "/"; temp += "/";
temp += targetNameFull; temp += targetNameFull;
fout << "\t\t\t\tOutputFile=\"" fout << "\t\t\t\tOutputFile=\""
<< this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n"; << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
this->WriteTargetVersionAttribute(fout, gt); this->WriteTargetVersionAttribute(fout, target);
linkOptions.OutputFlagMap(fout, "\t\t\t\t"); linkOptions.OutputFlagMap(fout, "\t\t\t\t");
fout << "\t\t\t\tAdditionalLibraryDirectories=\""; fout << "\t\t\t\tAdditionalLibraryDirectories=\"";
this->OutputLibraryDirectories(fout, cli.GetDirectories()); this->OutputLibraryDirectories(fout, cli.GetDirectories());
fout << "\"\n"; fout << "\"\n";
std::string path = this->ConvertToXMLOutputPathSingle( std::string path = this->ConvertToXMLOutputPathSingle(
gt->GetPDBDirectory(configName).c_str()); target->GetPDBDirectory(configName).c_str());
fout << "\t\t\t\tProgramDatabaseFile=\"" fout << "\t\t\t\tProgramDatabaseFile=\""
<< path << "/" << targetNamePDB << path << "/" << targetNamePDB
<< "\"\n"; << "\"\n";
@ -1367,7 +1360,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
{ {
fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\""; fout << "\t\t\t\tStackReserveSize=\"" << stackVal << "\"";
} }
temp = gt->GetDirectory(configName, true); temp = target->GetDirectory(configName, true);
temp += "/"; temp += "/";
temp += targetNameImport; temp += targetNameImport;
fout << "\t\t\t\tImportLibrary=\"" fout << "\t\t\t\tImportLibrary=\""
@ -1418,13 +1411,11 @@ cmLocalVisualStudio7GeneratorInternals
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmLocalVisualStudio7GeneratorInternals cmLocalVisualStudio7GeneratorInternals
::OutputObjects(std::ostream& fout, cmTarget* t, const char* isep) ::OutputObjects(std::ostream& fout, cmGeneratorTarget* gt, const char* isep)
{ {
// VS < 8 does not support per-config source locations so we // VS < 8 does not support per-config source locations so we
// list object library content on the link line instead. // list object library content on the link line instead.
cmLocalVisualStudio7Generator* lg = this->LocalGenerator; cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
cmGeneratorTarget* gt =
lg->GetGlobalGenerator()->GetGeneratorTarget(t);
std::vector<std::string> objs; std::vector<std::string> objs;
gt->UseObjectLibraries(objs, ""); gt->UseObjectLibraries(objs, "");
const char* sep = isep? isep : ""; const char* sep = isep? isep : "";
@ -1481,7 +1472,7 @@ cmLocalVisualStudio7Generator
void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
const std::string& libName, const std::string& libName,
cmTarget &target) cmGeneratorTarget* target)
{ {
std::vector<std::string> configs; std::vector<std::string> configs;
this->Makefile->GetConfigurations(configs); this->Makefile->GetConfigurations(configs);
@ -1489,13 +1480,10 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
// We may be modifying the source groups temporarily, so make a copy. // We may be modifying the source groups temporarily, so make a copy.
std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups(); std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
// get the classes from the source lists then add them to the groups // get the classes from the source lists then add them to the groups
this->ModuleDefinitionFile = ""; this->ModuleDefinitionFile = "";
std::vector<cmSourceFile*> classes; std::vector<cmSourceFile*> classes;
if (!gt->GetConfigCommonSourceFiles(classes)) if (!target->GetConfigCommonSourceFiles(classes))
{ {
return; return;
} }
@ -1538,7 +1526,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
// VS >= 8 support per-config source locations so we // VS >= 8 support per-config source locations so we
// list object library content as external objects. // list object library content as external objects.
std::vector<std::string> objs; std::vector<std::string> objs;
gt->UseObjectLibraries(objs, ""); target->UseObjectLibraries(objs, "");
if(!objs.empty()) if(!objs.empty())
{ {
// TODO: Separate sub-filter for each object library used? // TODO: Separate sub-filter for each object library used?
@ -1573,7 +1561,7 @@ class cmLocalVisualStudio7GeneratorFCInfo
{ {
public: public:
cmLocalVisualStudio7GeneratorFCInfo(cmLocalVisualStudio7Generator* lg, cmLocalVisualStudio7GeneratorFCInfo(cmLocalVisualStudio7Generator* lg,
cmTarget& target, cmGeneratorTarget* target,
cmSourceFile const& sf, cmSourceFile const& sf,
std::vector<std::string> const& configs); std::vector<std::string> const& configs);
std::map<std::string, cmLVS7GFileConfig> FileConfigMap; std::map<std::string, cmLVS7GFileConfig> FileConfigMap;
@ -1581,12 +1569,10 @@ public:
cmLocalVisualStudio7GeneratorFCInfo cmLocalVisualStudio7GeneratorFCInfo
::cmLocalVisualStudio7GeneratorFCInfo(cmLocalVisualStudio7Generator* lg, ::cmLocalVisualStudio7GeneratorFCInfo(cmLocalVisualStudio7Generator* lg,
cmTarget& target, cmGeneratorTarget* gt,
cmSourceFile const& sf, cmSourceFile const& sf,
std::vector<std::string> const& configs) std::vector<std::string> const& configs)
{ {
cmGeneratorTarget* gt =
lg->GetGlobalGenerator()->GetGeneratorTarget(&target);
std::string objectName; std::string objectName;
if(gt->HasExplicitObjectName(&sf)) if(gt->HasExplicitObjectName(&sf))
{ {
@ -1703,10 +1689,10 @@ cmLocalVisualStudio7GeneratorFCInfo
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmLocalVisualStudio7Generator cmLocalVisualStudio7Generator
::ComputeLongestObjectDirectory(cmTarget& target) const ::ComputeLongestObjectDirectory(cmGeneratorTarget const* target) const
{ {
std::vector<std::string> configs; std::vector<std::string> configs;
target.GetMakefile()->GetConfigurations(configs); target->Target->GetMakefile()->GetConfigurations(configs);
// Compute the maximum length configuration name. // Compute the maximum length configuration name.
std::string config_max; std::string config_max;
@ -1725,9 +1711,7 @@ cmLocalVisualStudio7Generator
std::string dir_max; std::string dir_max;
dir_max += this->GetCurrentBinaryDirectory(); dir_max += this->GetCurrentBinaryDirectory();
dir_max += "/"; dir_max += "/";
cmGeneratorTarget* gt = dir_max += this->GetTargetDirectory(target);
this->GlobalGenerator->GetGeneratorTarget(&target);
dir_max += this->GetTargetDirectory(gt);
dir_max += "/"; dir_max += "/";
dir_max += config_max; dir_max += config_max;
dir_max += "/"; dir_max += "/";
@ -1735,7 +1719,7 @@ cmLocalVisualStudio7Generator
} }
bool cmLocalVisualStudio7Generator bool cmLocalVisualStudio7Generator
::WriteGroup(const cmSourceGroup *sg, cmTarget& target, ::WriteGroup(const cmSourceGroup *sg, cmGeneratorTarget* target,
std::ostream &fout, const std::string& libName, std::ostream &fout, const std::string& libName,
std::vector<std::string> const& configs) std::vector<std::string> const& configs)
{ {
@ -1770,15 +1754,14 @@ bool cmLocalVisualStudio7Generator
} }
// Loop through each source in the source group. // Loop through each source in the source group.
std::string objectName;
for(std::vector<const cmSourceFile *>::const_iterator sf = for(std::vector<const cmSourceFile *>::const_iterator sf =
sourceFiles.begin(); sf != sourceFiles.end(); ++sf) sourceFiles.begin(); sf != sourceFiles.end(); ++sf)
{ {
std::string source = (*sf)->GetFullPath(); std::string source = (*sf)->GetFullPath();
FCInfo fcinfo(this, target, *(*sf), configs); FCInfo fcinfo(this, target, *(*sf), configs);
if (source != libName || target.GetType() == cmState::UTILITY || if (source != libName || target->GetType() == cmState::UTILITY ||
target.GetType() == cmState::GLOBAL_TARGET ) target->GetType() == cmState::GLOBAL_TARGET )
{ {
fout << "\t\t\t<File\n"; fout << "\t\t\t<File\n";
std::string d = this->ConvertToXMLOutputPathSingle(source.c_str()); std::string d = this->ConvertToXMLOutputPathSingle(source.c_str());
@ -2025,10 +2008,10 @@ void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout)
void cmLocalVisualStudio7Generator void cmLocalVisualStudio7Generator
::OutputTargetRules(std::ostream& fout, ::OutputTargetRules(std::ostream& fout,
const std::string& configName, const std::string& configName,
cmTarget &target, cmGeneratorTarget *target,
const std::string& /*libName*/) const std::string& /*libName*/)
{ {
if (target.GetType() > cmState::GLOBAL_TARGET) if (target->GetType() > cmState::GLOBAL_TARGET)
{ {
return; return;
} }
@ -2038,36 +2021,35 @@ void cmLocalVisualStudio7Generator
const char* tool = const char* tool =
this->FortranProject? "VFPreBuildEventTool":"VCPreBuildEventTool"; this->FortranProject? "VFPreBuildEventTool":"VCPreBuildEventTool";
event.Start(tool); event.Start(tool);
event.Write(target.GetPreBuildCommands()); event.Write(target->Target->GetPreBuildCommands());
event.Finish(); event.Finish();
// Add pre-link event. // Add pre-link event.
tool = this->FortranProject? "VFPreLinkEventTool":"VCPreLinkEventTool"; tool = this->FortranProject? "VFPreLinkEventTool":"VCPreLinkEventTool";
event.Start(tool); event.Start(tool);
bool addedPrelink = false; bool addedPrelink = false;
if (target.GetType() == cmState::SHARED_LIBRARY && if (target->GetType() == cmState::SHARED_LIBRARY &&
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
if (target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) if (target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
addedPrelink = true; addedPrelink = true;
std::vector<cmCustomCommand> commands = std::vector<cmCustomCommand> commands =
target.GetPreLinkCommands(); target->Target->GetPreLinkCommands();
cmGlobalVisualStudioGenerator* gg cmGlobalVisualStudioGenerator* gg
= static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator); = static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator);
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
gg->AddSymbolExportCommand( gg->AddSymbolExportCommand(
gt, commands, configName); target, commands, configName);
event.Write(commands); event.Write(commands);
} }
} }
if (!addedPrelink) if (!addedPrelink)
{ {
event.Write(target.GetPreLinkCommands()); event.Write(target->Target->GetPreLinkCommands());
} }
cmsys::auto_ptr<cmCustomCommand> pcc( cmsys::auto_ptr<cmCustomCommand> pcc(
this->MaybeCreateImplibDir(target, configName, this->FortranProject)); this->MaybeCreateImplibDir(target,
configName, this->FortranProject));
if(pcc.get()) if(pcc.get())
{ {
event.Write(*pcc); event.Write(*pcc);
@ -2077,18 +2059,18 @@ void cmLocalVisualStudio7Generator
// Add post-build event. // Add post-build event.
tool = this->FortranProject? "VFPostBuildEventTool":"VCPostBuildEventTool"; tool = this->FortranProject? "VFPostBuildEventTool":"VCPostBuildEventTool";
event.Start(tool); event.Start(tool);
event.Write(target.GetPostBuildCommands()); event.Write(target->Target->GetPostBuildCommands());
event.Finish(); event.Finish();
} }
void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout, void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout,
cmTarget& target) cmGeneratorTarget* target)
{ {
// if we have all the required Source code control tags // if we have all the required Source code control tags
// then add that to the project // then add that to the project
const char* vsProjectname = target.GetProperty("VS_SCC_PROJECTNAME"); const char* vsProjectname = target->GetProperty("VS_SCC_PROJECTNAME");
const char* vsLocalpath = target.GetProperty("VS_SCC_LOCALPATH"); const char* vsLocalpath = target->GetProperty("VS_SCC_LOCALPATH");
const char* vsProvider = target.GetProperty("VS_SCC_PROVIDER"); const char* vsProvider = target->GetProperty("VS_SCC_PROVIDER");
if(vsProvider && vsLocalpath && vsProjectname) if(vsProvider && vsLocalpath && vsProjectname)
{ {
@ -2096,7 +2078,7 @@ void cmLocalVisualStudio7Generator::WriteProjectSCC(std::ostream& fout,
<< "\tSccLocalPath=\"" << vsLocalpath << "\"\n" << "\tSccLocalPath=\"" << vsLocalpath << "\"\n"
<< "\tSccProvider=\"" << vsProvider << "\"\n"; << "\tSccProvider=\"" << vsProvider << "\"\n";
const char* vsAuxPath = target.GetProperty("VS_SCC_AUXPATH"); const char* vsAuxPath = target->GetProperty("VS_SCC_AUXPATH");
if(vsAuxPath) if(vsAuxPath)
{ {
fout << "\tSccAuxPath=\"" << vsAuxPath << "\"\n"; fout << "\tSccAuxPath=\"" << vsAuxPath << "\"\n";
@ -2108,7 +2090,7 @@ void
cmLocalVisualStudio7Generator cmLocalVisualStudio7Generator
::WriteProjectStartFortran(std::ostream& fout, ::WriteProjectStartFortran(std::ostream& fout,
const std::string& libName, const std::string& libName,
cmTarget & target) cmGeneratorTarget *target)
{ {
cmGlobalVisualStudio7Generator* gg = cmGlobalVisualStudio7Generator* gg =
@ -2118,13 +2100,13 @@ cmLocalVisualStudio7Generator
<< "<VisualStudioProject\n" << "<VisualStudioProject\n"
<< "\tProjectCreator=\"Intel Fortran\"\n" << "\tProjectCreator=\"Intel Fortran\"\n"
<< "\tVersion=\"" << gg->GetIntelProjectVersion() << "\"\n"; << "\tVersion=\"" << gg->GetIntelProjectVersion() << "\"\n";
const char* keyword = target.GetProperty("VS_KEYWORD"); const char* keyword = target->GetProperty("VS_KEYWORD");
if(!keyword) if(!keyword)
{ {
keyword = "Console Application"; keyword = "Console Application";
} }
const char* projectType = 0; const char* projectType = 0;
switch(target.GetType()) switch(target->GetType())
{ {
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
projectType = "typeStaticLibrary"; projectType = "typeStaticLibrary";
@ -2169,7 +2151,7 @@ cmLocalVisualStudio7Generator
void void
cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
const std::string& libName, const std::string& libName,
cmTarget & target, cmGeneratorTarget *target,
std::vector<cmSourceGroup> &) std::vector<cmSourceGroup> &)
{ {
if(this->FortranProject) if(this->FortranProject)
@ -2193,12 +2175,12 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
{ {
fout << "\tVersion=\"" << (gg->GetVersion()/10) << ".00\"\n"; fout << "\tVersion=\"" << (gg->GetVersion()/10) << ".00\"\n";
} }
const char* projLabel = target.GetProperty("PROJECT_LABEL"); const char* projLabel = target->GetProperty("PROJECT_LABEL");
if(!projLabel) if(!projLabel)
{ {
projLabel = libName.c_str(); projLabel = libName.c_str();
} }
const char* keyword = target.GetProperty("VS_KEYWORD"); const char* keyword = target->GetProperty("VS_KEYWORD");
if(!keyword) if(!keyword)
{ {
keyword = "Win32Proj"; keyword = "Win32Proj";
@ -2210,7 +2192,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
} }
this->WriteProjectSCC(fout, target); this->WriteProjectSCC(fout, target);
if(const char* targetFrameworkVersion = if(const char* targetFrameworkVersion =
target.GetProperty("VS_DOTNET_TARGET_FRAMEWORK_VERSION")) target->GetProperty("VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{ {
fout << "\tTargetFrameworkVersion=\"" << targetFrameworkVersion << "\"\n"; fout << "\tTargetFrameworkVersion=\"" << targetFrameworkVersion << "\"\n";
} }
@ -2231,12 +2213,13 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
} }
void cmLocalVisualStudio7Generator::WriteVCProjFooter(std::ostream& fout, void cmLocalVisualStudio7Generator::WriteVCProjFooter(
cmTarget &target) std::ostream& fout,
cmGeneratorTarget *target)
{ {
fout << "\t<Globals>\n"; fout << "\t<Globals>\n";
cmPropertyMap const& props = target.GetProperties(); cmPropertyMap const& props = target->Target->GetProperties();
for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i) for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i)
{ {
if(i->first.find("VS_GLOBAL_") == 0) if(i->first.find("VS_GLOBAL_") == 0)

View File

@ -15,7 +15,6 @@
#include "cmLocalVisualStudioGenerator.h" #include "cmLocalVisualStudioGenerator.h"
#include "cmVisualStudioGeneratorOptions.h" #include "cmVisualStudioGeneratorOptions.h"
class cmTarget;
class cmSourceFile; class cmSourceFile;
class cmCustomCommand; class cmCustomCommand;
class cmSourceGroup; class cmSourceGroup;
@ -57,13 +56,15 @@ public:
std::string GetTargetDirectory(cmGeneratorTarget const* target) const; std::string GetTargetDirectory(cmGeneratorTarget const* target) const;
cmSourceFile* CreateVCProjBuildRule(); cmSourceFile* CreateVCProjBuildRule();
void WriteStampFiles(); void WriteStampFiles();
virtual std::string ComputeLongestObjectDirectory(cmTarget&) const; virtual std::string
ComputeLongestObjectDirectory(cmGeneratorTarget const*) const;
virtual void ReadAndStoreExternalGUID(const std::string& name, virtual void ReadAndStoreExternalGUID(const std::string& name,
const char* path); const char* path);
virtual void AddCMakeListsRules(); virtual void AddCMakeListsRules();
protected: protected:
void CreateSingleVCProj(const std::string& lname, cmTarget &tgt); void CreateSingleVCProj(const std::string& lname,
cmGeneratorTarget *tgt);
private: private:
typedef cmVisualStudioGeneratorOptions Options; typedef cmVisualStudioGeneratorOptions Options;
typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo; typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
@ -72,30 +73,33 @@ private:
void FixGlobalTargets(); void FixGlobalTargets();
void WriteProjectFiles(); void WriteProjectFiles();
void WriteVCProjHeader(std::ostream& fout, const std::string& libName, void WriteVCProjHeader(std::ostream& fout, const std::string& libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs); cmGeneratorTarget* tgt,
void WriteVCProjFooter(std::ostream& fout, cmTarget &target); std::vector<cmSourceGroup> &sgs);
void WriteVCProjFooter(std::ostream& fout, cmGeneratorTarget* target);
void WriteVCProjFile(std::ostream& fout, const std::string& libName, void WriteVCProjFile(std::ostream& fout, const std::string& libName,
cmTarget &tgt); cmGeneratorTarget* tgt);
void WriteConfigurations(std::ostream& fout, void WriteConfigurations(std::ostream& fout,
std::vector<std::string> const& configs, std::vector<std::string> const& configs,
const std::string& libName, cmTarget &tgt); const std::string& libName, cmGeneratorTarget* tgt);
void WriteConfiguration(std::ostream& fout, void WriteConfiguration(std::ostream& fout,
const std::string& configName, const std::string& configName,
const std::string& libName, cmTarget &tgt); const std::string& libName, cmGeneratorTarget* tgt);
std::string EscapeForXML(const std::string& s); std::string EscapeForXML(const std::string& s);
std::string ConvertToXMLOutputPath(const char* path); std::string ConvertToXMLOutputPath(const char* path);
std::string ConvertToXMLOutputPathSingle(const char* path); std::string ConvertToXMLOutputPathSingle(const char* path);
void OutputTargetRules(std::ostream& fout, const std::string& configName, void OutputTargetRules(std::ostream& fout, const std::string& configName,
cmTarget &target, const std::string& libName); cmGeneratorTarget* target,
const std::string& libName);
void OutputBuildTool(std::ostream& fout, const std::string& configName, void OutputBuildTool(std::ostream& fout, const std::string& configName,
cmTarget& t, const Options& targetOptions); cmGeneratorTarget* t, const Options& targetOptions);
void OutputLibraryDirectories(std::ostream& fout, void OutputLibraryDirectories(std::ostream& fout,
std::vector<std::string> const& dirs); std::vector<std::string> const& dirs);
void WriteProjectSCC(std::ostream& fout, cmTarget& target); void WriteProjectSCC(std::ostream& fout, cmGeneratorTarget *target);
void WriteProjectStart(std::ostream& fout, const std::string& libName, void WriteProjectStart(std::ostream& fout, const std::string& libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs); cmGeneratorTarget* tgt,
std::vector<cmSourceGroup> &sgs);
void WriteProjectStartFortran(std::ostream& fout, const std::string& libName, void WriteProjectStartFortran(std::ostream& fout, const std::string& libName,
cmTarget &tgt); cmGeneratorTarget* tgt);
void WriteVCProjBeginGroup(std::ostream& fout, void WriteVCProjBeginGroup(std::ostream& fout,
const char* group, const char* group,
const char* filter); const char* filter);
@ -110,7 +114,7 @@ private:
cmGeneratorTarget* gt); cmGeneratorTarget* gt);
bool WriteGroup(const cmSourceGroup *sg, bool WriteGroup(const cmSourceGroup *sg,
cmTarget& target, std::ostream &fout, cmGeneratorTarget* target, std::ostream &fout,
const std::string& libName, const std::string& libName,
std::vector<std::string> const& configs); std::vector<std::string> const& configs);

View File

@ -43,7 +43,7 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
std::map<cmSourceFile const*, std::string>& mapping, std::map<cmSourceFile const*, std::string>& mapping,
cmGeneratorTarget const* gt) cmGeneratorTarget const* gt)
{ {
std::string dir_max = this->ComputeLongestObjectDirectory(*gt->Target); std::string dir_max = this->ComputeLongestObjectDirectory(gt);
// Count the number of object files with each name. Note that // Count the number of object files with each name. Note that
// windows file names are not case sensitive. // windows file names are not case sensitive.
@ -80,7 +80,7 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmsys::auto_ptr<cmCustomCommand> cmsys::auto_ptr<cmCustomCommand>
cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target, cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target,
const std::string& config, const std::string& config,
bool isFortran) bool isFortran)
{ {
@ -89,13 +89,11 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
// If an executable exports symbols then VS wants to create an // If an executable exports symbols then VS wants to create an
// import library but forgets to create the output directory. // import library but forgets to create the output directory.
// The Intel Fortran plugin always forgets to the directory. // The Intel Fortran plugin always forgets to the directory.
if(target.GetType() != cmState::EXECUTABLE && if(target->GetType() != cmState::EXECUTABLE &&
!(isFortran && target.GetType() == cmState::SHARED_LIBRARY)) !(isFortran && target->GetType() == cmState::SHARED_LIBRARY))
{ return pcc; } { return pcc; }
cmGeneratorTarget* gt = std::string outDir = target->GetDirectory(config, false);
this->GetGlobalGenerator()->GetGeneratorTarget(&target); std::string impDir = target->GetDirectory(config, true);
std::string outDir = gt->GetDirectory(config, false);
std::string impDir = gt->GetDirectory(config, true);
if(impDir == outDir) { return pcc; } if(impDir == outDir) { return pcc; }
// Add a pre-build event to create the directory. // Add a pre-build event to create the directory.

View File

@ -44,7 +44,8 @@ public:
cmGlobalVisualStudioGenerator::VSVersion GetVersion() const; cmGlobalVisualStudioGenerator::VSVersion GetVersion() const;
virtual std::string ComputeLongestObjectDirectory(cmTarget&) const = 0; virtual std::string
ComputeLongestObjectDirectory(cmGeneratorTarget const*) const = 0;
virtual void AddCMakeListsRules() = 0; virtual void AddCMakeListsRules() = 0;
@ -58,7 +59,8 @@ protected:
/** Construct a custom command to make exe import lib dir. */ /** Construct a custom command to make exe import lib dir. */
cmsys::auto_ptr<cmCustomCommand> cmsys::auto_ptr<cmCustomCommand>
MaybeCreateImplibDir(cmTarget& target, const std::string& config, MaybeCreateImplibDir(cmGeneratorTarget *target,
const std::string& config,
bool isFortran); bool isFortran);
}; };

View File

@ -16,7 +16,6 @@
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmTarget.h"
#include "cmake.h" #include "cmake.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -279,11 +278,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
if(!relink) if(!relink)
{ {
this->LocalGenerator this->LocalGenerator
->AppendCustomCommands(commands, this->Target->GetPreBuildCommands(), ->AppendCustomCommands(commands,
this->GeneratorTarget); this->GeneratorTarget->Target->GetPreBuildCommands(),
this->GeneratorTarget);
this->LocalGenerator this->LocalGenerator
->AppendCustomCommands(commands, this->Target->GetPreLinkCommands(), ->AppendCustomCommands(commands,
this->GeneratorTarget); this->GeneratorTarget->Target->GetPreLinkCommands(),
this->GeneratorTarget);
} }
// Determine whether a link script will be used. // Determine whether a link script will be used.
@ -448,8 +449,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
if(!relink) if(!relink)
{ {
this->LocalGenerator-> this->LocalGenerator->
AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), AppendCustomCommands(commands,
this->GeneratorTarget); this->GeneratorTarget->Target->GetPostBuildCommands(),
this->GeneratorTarget);
} }
// Write the build rule. // Write the build rule.

View File

@ -16,7 +16,6 @@
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmTarget.h"
#include "cmake.h" #include "cmake.h"
#include "cmAlgorithms.h" #include "cmAlgorithms.h"
@ -114,7 +113,8 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
// Add post-build rules. // Add post-build rules.
this->LocalGenerator-> this->LocalGenerator->
AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), AppendCustomCommands(commands,
this->GeneratorTarget->Target->GetPostBuildCommands(),
this->GeneratorTarget); this->GeneratorTarget);
// Depend on the object files. // Depend on the object files.
@ -457,11 +457,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
if(!relink) if(!relink)
{ {
this->LocalGenerator this->LocalGenerator
->AppendCustomCommands(commands, this->Target->GetPreBuildCommands(), ->AppendCustomCommands(commands,
this->GeneratorTarget); this->GeneratorTarget->Target->GetPreBuildCommands(),
this->GeneratorTarget);
this->LocalGenerator this->LocalGenerator
->AppendCustomCommands(commands, this->Target->GetPreLinkCommands(), ->AppendCustomCommands(commands,
this->GeneratorTarget); this->GeneratorTarget->Target->GetPreLinkCommands(),
this->GeneratorTarget);
} }
// Determine whether a link script will be used. // Determine whether a link script will be used.
@ -811,8 +813,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
if(!relink) if(!relink)
{ {
this->LocalGenerator-> this->LocalGenerator->
AppendCustomCommands(commands, this->Target->GetPostBuildCommands(), AppendCustomCommands(commands,
this->GeneratorTarget); this->GeneratorTarget->Target->GetPostBuildCommands(),
this->GeneratorTarget);
} }
// Compute the list of outputs. // Compute the list of outputs.

View File

@ -18,7 +18,6 @@
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmTarget.h"
#include "cmake.h" #include "cmake.h"
#include "cmState.h" #include "cmState.h"
#include "cmComputeLinkInformation.h" #include "cmComputeLinkInformation.h"
@ -432,7 +431,7 @@ void cmMakefileTargetGenerator
std::string srcFullPath = std::string srcFullPath =
this->Convert(source.GetFullPath(), cmLocalGenerator::FULL); this->Convert(source.GetFullPath(), cmLocalGenerator::FULL);
this->LocalGenerator-> this->LocalGenerator->
AddImplicitDepends(*this->Target, lang, AddImplicitDepends(this->GeneratorTarget, lang,
objFullPath.c_str(), objFullPath.c_str(),
srcFullPath.c_str()); srcFullPath.c_str());
} }
@ -1241,7 +1240,7 @@ void cmMakefileTargetGenerator
std::string srcFullPath = std::string srcFullPath =
this->Convert(idi->second, cmLocalGenerator::FULL); this->Convert(idi->second, cmLocalGenerator::FULL);
this->LocalGenerator-> this->LocalGenerator->
AddImplicitDepends(*this->Target, idi->first, AddImplicitDepends(this->GeneratorTarget, idi->first,
objFullPath.c_str(), objFullPath.c_str(),
srcFullPath.c_str()); srcFullPath.c_str());
} }

View File

@ -24,7 +24,6 @@ class cmGeneratedFileStream;
class cmGlobalUnixMakefileGenerator3; class cmGlobalUnixMakefileGenerator3;
class cmLocalUnixMakefileGenerator3; class cmLocalUnixMakefileGenerator3;
class cmMakefile; class cmMakefile;
class cmTarget;
class cmSourceFile; class cmSourceFile;
/** \class cmMakefileTargetGenerator /** \class cmMakefileTargetGenerator
@ -51,7 +50,6 @@ public:
std::string GetProgressFileNameFull() std::string GetProgressFileNameFull()
{ return this->ProgressFileNameFull; } { return this->ProgressFileNameFull; }
cmTarget* GetTarget() { return this->Target;}
cmGeneratorTarget* GetGeneratorTarget() { return this->GeneratorTarget;} cmGeneratorTarget* GetGeneratorTarget() { return this->GeneratorTarget;}
protected: protected:

View File

@ -16,7 +16,6 @@
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmTarget.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmMakefileUtilityTargetGenerator cmMakefileUtilityTargetGenerator
@ -68,19 +67,21 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
// Utility targets store their rules in pre- and post-build commands. // Utility targets store their rules in pre- and post-build commands.
this->LocalGenerator->AppendCustomDepends this->LocalGenerator->AppendCustomDepends
(depends, this->Target->GetPreBuildCommands()); (depends, this->GeneratorTarget->Target->GetPreBuildCommands());
this->LocalGenerator->AppendCustomDepends this->LocalGenerator->AppendCustomDepends
(depends, this->Target->GetPostBuildCommands()); (depends, this->GeneratorTarget->Target->GetPostBuildCommands());
this->LocalGenerator->AppendCustomCommands this->LocalGenerator->AppendCustomCommands
(commands, this->Target->GetPreBuildCommands(), this->GeneratorTarget); (commands, this->GeneratorTarget->Target->GetPreBuildCommands(),
this->GeneratorTarget);
// Depend on all custom command outputs for sources // Depend on all custom command outputs for sources
this->DriveCustomCommands(depends); this->DriveCustomCommands(depends);
this->LocalGenerator->AppendCustomCommands this->LocalGenerator->AppendCustomCommands
(commands, this->Target->GetPostBuildCommands(), this->GeneratorTarget); (commands, this->GeneratorTarget->Target->GetPostBuildCommands(),
this->GeneratorTarget);
// Add dependencies on targets that must be built first. // Add dependencies on targets that must be built first.
this->AppendTargetDepends(depends); this->AppendTargetDepends(depends);

View File

@ -399,7 +399,6 @@ static int calculateCommandLineLengthLimit(int linkRuleLength)
void cmNinjaNormalTargetGenerator::WriteLinkStatement() void cmNinjaNormalTargetGenerator::WriteLinkStatement()
{ {
cmTarget& target = *this->GetTarget();
cmGeneratorTarget& gt = *this->GetGeneratorTarget(); cmGeneratorTarget& gt = *this->GetGeneratorTarget();
const std::string cfgName = this->GetConfigName(); const std::string cfgName = this->GetConfigName();
std::string targetOutput = ConvertToNinjaPath( std::string targetOutput = ConvertToNinjaPath(
@ -443,7 +442,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// Write comments. // Write comments.
cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream()); cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream());
const cmState::TargetType targetType = target.GetType(); const cmState::TargetType targetType = gt.GetType();
this->GetBuildFileStream() this->GetBuildFileStream()
<< "# Link build statements for " << "# Link build statements for "
<< cmState::GetTargetTypeName(targetType) << cmState::GetTargetTypeName(targetType)
@ -490,13 +489,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
&genTarget, &genTarget,
useWatcomQuote); useWatcomQuote);
if(this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") if(this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")
&& target.GetType() == cmState::SHARED_LIBRARY) && gt.GetType() == cmState::SHARED_LIBRARY)
{ {
if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) if(gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
std::string name_of_def_file std::string name_of_def_file
= gt.GetSupportDirectory(); = gt.GetSupportDirectory();
name_of_def_file += "/" + target.GetName(); name_of_def_file += "/" + gt.GetName();
name_of_def_file += ".def "; name_of_def_file += ".def ";
vars["LINK_FLAGS"] += " /DEF:"; vars["LINK_FLAGS"] += " /DEF:";
vars["LINK_FLAGS"] += this->GetLocalGenerator() vars["LINK_FLAGS"] += this->GetLocalGenerator()
@ -505,7 +504,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
} }
} }
this->addPoolNinjaVariable("JOB_POOL_LINK", &target, vars); this->addPoolNinjaVariable("JOB_POOL_LINK", &gt, vars);
this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]); this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
vars["LINK_FLAGS"] = cmGlobalNinjaGenerator vars["LINK_FLAGS"] = cmGlobalNinjaGenerator
@ -599,9 +598,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
} }
const std::vector<cmCustomCommand> *cmdLists[3] = { const std::vector<cmCustomCommand> *cmdLists[3] = {
&target.GetPreBuildCommands(), &gt.Target->GetPreBuildCommands(),
&target.GetPreLinkCommands(), &gt.Target->GetPreLinkCommands(),
&target.GetPostBuildCommands() &gt.Target->GetPostBuildCommands()
}; };
std::vector<std::string> preLinkCmdLines, postBuildCmdLines; std::vector<std::string> preLinkCmdLines, postBuildCmdLines;
@ -626,17 +625,17 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
} }
// maybe create .def file from list of objects // maybe create .def file from list of objects
if (target.GetType() == cmState::SHARED_LIBRARY && if (gt.GetType() == cmState::SHARED_LIBRARY &&
this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
if(target.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) if(gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"))
{ {
std::string cmakeCommand = std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat( this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
std::string name_of_def_file std::string name_of_def_file
= gt.GetSupportDirectory(); = gt.GetSupportDirectory();
name_of_def_file += "/" + target.GetName(); name_of_def_file += "/" + gt.GetName();
name_of_def_file += ".def"; name_of_def_file += ".def";
std::string cmd = cmakeCommand; std::string cmd = cmakeCommand;
cmd += " -E __create_def "; cmd += " -E __create_def ";
@ -699,11 +698,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
const std::string rspfile = const std::string rspfile =
std::string(cmake::GetCMakeFilesDirectoryPostSlash()) std::string(cmake::GetCMakeFilesDirectoryPostSlash())
+ target.GetName() + ".rsp"; + gt.GetName() + ".rsp";
// Gather order-only dependencies. // Gather order-only dependencies.
cmNinjaDeps orderOnlyDeps; cmNinjaDeps orderOnlyDeps;
this->GetLocalGenerator()->AppendTargetDepends(this->GetTarget(), this->GetLocalGenerator()->AppendTargetDepends(this->GetGeneratorTarget(),
orderOnlyDeps); orderOnlyDeps);
// Ninja should restat after linking if and only if there are byproducts. // Ninja should restat after linking if and only if there are byproducts.
@ -772,8 +771,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
} }
// Add aliases for the file name and the target name. // Add aliases for the file name and the target name.
globalGen.AddTargetAlias(this->TargetNameOut, &target); globalGen.AddTargetAlias(this->TargetNameOut, &gt);
globalGen.AddTargetAlias(this->GetTargetName(), &target); globalGen.AddTargetAlias(this->GetTargetName(), &gt);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -781,7 +780,8 @@ void cmNinjaNormalTargetGenerator::WriteObjectLibStatement()
{ {
// Write a phony output that depends on all object files. // Write a phony output that depends on all object files.
cmNinjaDeps outputs; cmNinjaDeps outputs;
this->GetLocalGenerator()->AppendTargetOutputs(this->GetTarget(), outputs); this->GetLocalGenerator()->AppendTargetOutputs(this->GetGeneratorTarget(),
outputs);
cmNinjaDeps depends = this->GetObjects(); cmNinjaDeps depends = this->GetObjects();
this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(), this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
"Object library " "Object library "
@ -791,5 +791,5 @@ void cmNinjaNormalTargetGenerator::WriteObjectLibStatement()
// Add aliases for the target name. // Add aliases for the target name.
this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(), this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
this->GetTarget()); this->GetGeneratorTarget());
} }

View File

@ -486,7 +486,8 @@ cmNinjaTargetGenerator
si != customCommands.end(); ++si) si != customCommands.end(); ++si)
{ {
cmCustomCommand const* cc = (*si)->GetCustomCommand(); cmCustomCommand const* cc = (*si)->GetCustomCommand();
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget()); this->GetLocalGenerator()->AddCustomCommandTarget(cc,
this->GetGeneratorTarget());
// Record the custom commands for this target. The container is used // Record the custom commands for this target. The container is used
// in WriteObjectBuildStatement when called in a loop below. // in WriteObjectBuildStatement when called in a loop below.
this->CustomCommands.push_back(cc); this->CustomCommands.push_back(cc);
@ -511,7 +512,8 @@ cmNinjaTargetGenerator
} }
cmNinjaDeps orderOnlyDeps; cmNinjaDeps orderOnlyDeps;
this->GetLocalGenerator()->AppendTargetDepends(this->Target, orderOnlyDeps); this->GetLocalGenerator()->AppendTargetDepends(this->GeneratorTarget,
orderOnlyDeps);
// Add order-only dependencies on custom command outputs. // Add order-only dependencies on custom command outputs.
for(std::vector<cmCustomCommand const*>::const_iterator for(std::vector<cmCustomCommand const*>::const_iterator
@ -633,7 +635,8 @@ cmNinjaTargetGenerator
ConvertToNinjaPath(objectFileDir), ConvertToNinjaPath(objectFileDir),
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);
this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetTarget(), vars); this->addPoolNinjaVariable("JOB_POOL_COMPILE",
this->GetGeneratorTarget(), vars);
this->SetMsvcTargetPdbVariable(vars); this->SetMsvcTargetPdbVariable(vars);
@ -782,7 +785,7 @@ cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
void cmNinjaTargetGenerator::addPoolNinjaVariable( void cmNinjaTargetGenerator::addPoolNinjaVariable(
const std::string& pool_property, const std::string& pool_property,
cmTarget* target, cmGeneratorTarget* target,
cmNinjaVars& vars) cmNinjaVars& vars)
{ {
const char* pool = target->GetProperty(pool_property); const char* pool = target->GetProperty(pool_property);

View File

@ -53,9 +53,6 @@ protected:
cmGeneratedFileStream& GetBuildFileStream() const; cmGeneratedFileStream& GetBuildFileStream() const;
cmGeneratedFileStream& GetRulesFileStream() const; cmGeneratedFileStream& GetRulesFileStream() const;
cmTarget* GetTarget() const
{ return this->Target; }
cmGeneratorTarget* GetGeneratorTarget() const cmGeneratorTarget* GetGeneratorTarget() const
{ return this->GeneratorTarget; } { return this->GeneratorTarget; }
@ -152,7 +149,7 @@ protected:
std::set<std::string> MacContentFolders; std::set<std::string> MacContentFolders;
void addPoolNinjaVariable(const std::string& pool_property, void addPoolNinjaVariable(const std::string& pool_property,
cmTarget* target, cmGeneratorTarget* target,
cmNinjaVars& vars); cmNinjaVars& vars);
private: private:

View File

@ -16,7 +16,6 @@
#include "cmGlobalNinjaGenerator.h" #include "cmGlobalNinjaGenerator.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmTarget.h"
#include "cmCustomCommandGenerator.h" #include "cmCustomCommandGenerator.h"
cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator( cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator(
@ -34,8 +33,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName); cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName);
const std::vector<cmCustomCommand> *cmdLists[2] = { const std::vector<cmCustomCommand> *cmdLists[2] = {
&this->GetTarget()->GetPreBuildCommands(), &this->GetGeneratorTarget()->Target->GetPreBuildCommands(),
&this->GetTarget()->GetPostBuildCommands() &this->GetGeneratorTarget()->Target->GetPostBuildCommands()
}; };
bool uses_terminal = false; bool uses_terminal = false;
@ -66,7 +65,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
{ {
cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
this->GetLocalGenerator()); this->GetLocalGenerator());
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget()); this->GetLocalGenerator()->AddCustomCommandTarget(cc,
this->GetGeneratorTarget());
// Depend on all custom command outputs. // Depend on all custom command outputs.
const std::vector<std::string>& ccOutputs = ccg.GetOutputs(); const std::vector<std::string>& ccOutputs = ccg.GetOutputs();
@ -78,8 +78,10 @@ void cmNinjaUtilityTargetGenerator::Generate()
} }
} }
this->GetLocalGenerator()->AppendTargetOutputs(this->GetTarget(), outputs); this->GetLocalGenerator()->AppendTargetOutputs(this->GetGeneratorTarget(),
this->GetLocalGenerator()->AppendTargetDepends(this->GetTarget(), deps); outputs);
this->GetLocalGenerator()->AppendTargetDepends(this->GetGeneratorTarget(),
deps);
if (commands.empty()) { if (commands.empty()) {
this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(), this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
@ -140,5 +142,5 @@ void cmNinjaUtilityTargetGenerator::Generate()
} }
this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(), this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(),
this->GetTarget()); this->GetGeneratorTarget());
} }

View File

@ -895,7 +895,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
commandLines, false, autogenComment.c_str()); commandLines, false, autogenComment.c_str());
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg); cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
lg->AddGeneratorTarget(autogenTarget, gt); lg->AddGeneratorTarget(gt);
lg->GetGlobalGenerator()->AddGeneratorTarget(autogenTarget, gt); lg->GetGlobalGenerator()->AddGeneratorTarget(autogenTarget, gt);
// Set target folder // Set target folder

View File

@ -260,6 +260,10 @@ public:
return this->LinkLibrariesForVS6;} return this->LinkLibrariesForVS6;}
#endif #endif
struct StrictTargetComparison {
bool operator()(cmTarget const* t1, cmTarget const* t2) const;
};
private: private:
bool HandleLocationPropertyPolicy(cmMakefile* context) const; bool HandleLocationPropertyPolicy(cmMakefile* context) const;

View File

@ -13,7 +13,6 @@
#include "cmVisualStudio10TargetGenerator.h" #include "cmVisualStudio10TargetGenerator.h"
#include "cmGlobalVisualStudio10Generator.h" #include "cmGlobalVisualStudio10Generator.h"
#include "cmGeneratorTarget.h" #include "cmGeneratorTarget.h"
#include "cmTarget.h"
#include "cmComputeLinkInformation.h" #include "cmComputeLinkInformation.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmMakefile.h" #include "cmMakefile.h"
@ -167,13 +166,12 @@ static std::string cmVS10EscapeComment(std::string comment)
} }
cmVisualStudio10TargetGenerator:: cmVisualStudio10TargetGenerator::
cmVisualStudio10TargetGenerator(cmTarget* target, cmVisualStudio10TargetGenerator(cmGeneratorTarget* target,
cmGlobalVisualStudio10Generator* gg) cmGlobalVisualStudio10Generator* gg)
{ {
this->GlobalGenerator = gg; this->GlobalGenerator = gg;
this->Target = target; this->GeneratorTarget = target;
this->GeneratorTarget = gg->GetGeneratorTarget(target); this->Makefile = target->Target->GetMakefile();
this->Makefile = target->GetMakefile();
this->Makefile->GetConfigurations(this->Configurations); this->Makefile->GetConfigurations(this->Configurations);
this->LocalGenerator = this->LocalGenerator =
(cmLocalVisualStudio7Generator*) (cmLocalVisualStudio7Generator*)
@ -275,8 +273,9 @@ void cmVisualStudio10TargetGenerator::Generate()
return; return;
} }
// Tell the global generator the name of the project file // Tell the global generator the name of the project file
this->Target->SetProperty("GENERATOR_FILE_NAME",this->Name.c_str()); this->GeneratorTarget->Target
this->Target->SetProperty("GENERATOR_FILE_NAME_EXT", ->SetProperty("GENERATOR_FILE_NAME",this->Name.c_str());
this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
".vcxproj"); ".vcxproj");
if(this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) if(this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY)
{ {
@ -732,7 +731,8 @@ void cmVisualStudio10TargetGenerator
cmGlobalVisualStudio10Generator* gg = cmGlobalVisualStudio10Generator* gg =
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator); static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
const char* mfcFlag = const char* mfcFlag =
this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG"); this->GeneratorTarget->
Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG");
std::string mfcFlagValue = mfcFlag ? mfcFlag : "0"; std::string mfcFlagValue = mfcFlag ? mfcFlag : "0";
std::string useOfMfcValue = "false"; std::string useOfMfcValue = "false";
@ -1462,7 +1462,8 @@ void cmVisualStudio10TargetGenerator::WriteSource(
} }
else else
{ {
this->GlobalGenerator->PathTooLong(this->Target, sf, sourceRel); this->GlobalGenerator->PathTooLong(this->GeneratorTarget,
sf, sourceRel);
} }
} }
this->ConvertToWindowsSlash(sourceFile); this->ConvertToWindowsSlash(sourceFile);
@ -1915,12 +1916,12 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
std::string baseFlagVar = "CMAKE_"; std::string baseFlagVar = "CMAKE_";
baseFlagVar += linkLanguage; baseFlagVar += linkLanguage;
baseFlagVar += "_FLAGS"; baseFlagVar += "_FLAGS";
flags = this-> flags = this->GeneratorTarget->
Target->GetMakefile()->GetRequiredDefinition(baseFlagVar.c_str()); Target->GetMakefile()->GetRequiredDefinition(baseFlagVar.c_str());
std::string flagVar = baseFlagVar + std::string("_") + std::string flagVar = baseFlagVar + std::string("_") +
cmSystemTools::UpperCase(configName); cmSystemTools::UpperCase(configName);
flags += " "; flags += " ";
flags += this-> flags += this->GeneratorTarget->
Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str()); Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str());
} }
// set the correct language // set the correct language
@ -1936,7 +1937,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
linkLanguage, configName.c_str()); linkLanguage, configName.c_str());
// Get preprocessor definitions for this directory. // Get preprocessor definitions for this directory.
std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags(); std::string defineFlags =
this->GeneratorTarget->Target->GetMakefile()->GetDefineFlags();
if(this->MSTools) if(this->MSTools)
{ {
clOptions.FixExceptionHandlingDefault(); clOptions.FixExceptionHandlingDefault();
@ -2440,11 +2442,11 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
linkFlagVarBase += linkType; linkFlagVarBase += linkType;
linkFlagVarBase += "_LINKER_FLAGS"; linkFlagVarBase += "_LINKER_FLAGS";
flags += " "; flags += " ";
flags += this-> flags += this->GeneratorTarget->
Target->GetMakefile()->GetRequiredDefinition(linkFlagVarBase.c_str()); Target->GetMakefile()->GetRequiredDefinition(linkFlagVarBase.c_str());
std::string linkFlagVar = linkFlagVarBase + "_" + CONFIG; std::string linkFlagVar = linkFlagVarBase + "_" + CONFIG;
flags += " "; flags += " ";
flags += this-> flags += this->GeneratorTarget->
Target->GetMakefile()->GetRequiredDefinition(linkFlagVar.c_str()); Target->GetMakefile()->GetRequiredDefinition(linkFlagVar.c_str());
const char* targetLinkFlags = const char* targetLinkFlags =
this->GeneratorTarget->GetProperty("LINK_FLAGS"); this->GeneratorTarget->GetProperty("LINK_FLAGS");
@ -2674,7 +2676,8 @@ cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& config)
linkOptions.OutputFlagMap(*this->BuildFileStream, " "); linkOptions.OutputFlagMap(*this->BuildFileStream, " ");
this->WriteString("</Link>\n", 2); this->WriteString("</Link>\n", 2);
if(!this->GlobalGenerator->NeedLinkLibraryDependencies(*this->Target)) if(!this->GlobalGenerator->NeedLinkLibraryDependencies(
this->GeneratorTarget))
{ {
this->WriteString("<ProjectReference>\n", 2); this->WriteString("<ProjectReference>\n", 2);
this->WriteString( this->WriteString(
@ -2811,7 +2814,7 @@ cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
{ {
addedPrelink = true; addedPrelink = true;
std::vector<cmCustomCommand> commands = std::vector<cmCustomCommand> commands =
this->Target->GetPreLinkCommands(); this->GeneratorTarget->Target->GetPreLinkCommands();
this->GlobalGenerator->AddSymbolExportCommand( this->GlobalGenerator->AddSymbolExportCommand(
this->GeneratorTarget, commands, configName); this->GeneratorTarget, commands, configName);
this->WriteEvent("PreLinkEvent", commands, configName); this->WriteEvent("PreLinkEvent", commands, configName);
@ -2820,12 +2823,12 @@ cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
if (!addedPrelink) if (!addedPrelink)
{ {
this->WriteEvent("PreLinkEvent", this->WriteEvent("PreLinkEvent",
this->Target->GetPreLinkCommands(), configName); this->GeneratorTarget->Target->GetPreLinkCommands(), configName);
} }
this->WriteEvent("PreBuildEvent", this->WriteEvent("PreBuildEvent",
this->Target->GetPreBuildCommands(), configName); this->GeneratorTarget->Target->GetPreBuildCommands(), configName);
this->WriteEvent("PostBuildEvent", this->WriteEvent("PostBuildEvent",
this->Target->GetPostBuildCommands(), configName); this->GeneratorTarget->Target->GetPostBuildCommands(), configName);
} }
void cmVisualStudio10TargetGenerator::WriteEvent( void cmVisualStudio10TargetGenerator::WriteEvent(
@ -2875,7 +2878,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
for( OrderedTargetDependSet::const_iterator i = depends.begin(); for( OrderedTargetDependSet::const_iterator i = depends.begin();
i != depends.end(); ++i) i != depends.end(); ++i)
{ {
cmTarget const* dt = (*i)->Target; cmGeneratorTarget const* dt = *i;
if(dt->GetType() == cmState::INTERFACE_LIBRARY) if(dt->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
@ -2883,12 +2886,12 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
// skip fortran targets as they can not be processed by MSBuild // skip fortran targets as they can not be processed by MSBuild
// the only reference will be in the .sln file // the only reference will be in the .sln file
if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator) if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
->TargetIsFortranOnly(*dt)) ->TargetIsFortranOnly(dt))
{ {
continue; continue;
} }
this->WriteString("<ProjectReference Include=\"", 2); this->WriteString("<ProjectReference Include=\"", 2);
cmMakefile* mf = dt->GetMakefile(); cmLocalGenerator* lg = dt->GetLocalGenerator();
std::string name = dt->GetName(); std::string name = dt->GetName();
std::string path; std::string path;
const char* p = dt->GetProperty("EXTERNAL_MSPROJECT"); const char* p = dt->GetProperty("EXTERNAL_MSPROJECT");
@ -2898,7 +2901,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences()
} }
else else
{ {
path = mf->GetCurrentBinaryDirectory(); path = lg->GetCurrentBinaryDirectory();
path += "/"; path += "/";
path += dt->GetName(); path += dt->GetName();
path += ".vcxproj"; path += ".vcxproj";

View File

@ -13,7 +13,6 @@
#define cmVisualStudioTargetGenerator_h #define cmVisualStudioTargetGenerator_h
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
class cmTarget;
class cmMakefile; class cmMakefile;
class cmGeneratorTarget; class cmGeneratorTarget;
class cmGeneratedFileStream; class cmGeneratedFileStream;
@ -29,7 +28,7 @@ struct cmIDEFlagTable;
class cmVisualStudio10TargetGenerator class cmVisualStudio10TargetGenerator
{ {
public: public:
cmVisualStudio10TargetGenerator(cmTarget* target, cmVisualStudio10TargetGenerator(cmGeneratorTarget* target,
cmGlobalVisualStudio10Generator* gg); cmGlobalVisualStudio10Generator* gg);
~cmVisualStudio10TargetGenerator(); ~cmVisualStudio10TargetGenerator();
void Generate(); void Generate();
@ -148,7 +147,6 @@ private:
OptionsMap LinkOptions; OptionsMap LinkOptions;
std::string PathToVcxproj; std::string PathToVcxproj;
std::vector<std::string> Configurations; std::vector<std::string> Configurations;
cmTarget* Target;
cmGeneratorTarget* GeneratorTarget; cmGeneratorTarget* GeneratorTarget;
cmMakefile* Makefile; cmMakefile* Makefile;
std::string Platform; std::string Platform;

View File

@ -13,7 +13,7 @@
#define cmXCodeObject_h #define cmXCodeObject_h
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
class cmTarget; class cmGeneratorTarget;
class cmXCodeObject class cmXCodeObject
{ {
@ -87,11 +87,11 @@ public:
{ {
this->Id = id; this->Id = id;
} }
cmTarget* GetTarget() cmGeneratorTarget* GetTarget()
{ {
return this->Target; return this->Target;
} }
void SetTarget(cmTarget* t) void SetTarget(cmGeneratorTarget* t)
{ {
this->Target = t; this->Target = t;
} }
@ -146,7 +146,7 @@ public:
protected: protected:
void PrintString(std::ostream& os) const; void PrintString(std::ostream& os) const;
cmTarget* Target; cmGeneratorTarget* Target;
Type TypeValue; Type TypeValue;
std::string Id; std::string Id;
PBXType IsA; PBXType IsA;