VS6: Port to cmGeneratorTarget.
This commit is contained in:
parent
a0ebd69b52
commit
7f8bb857b8
@ -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->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->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,7 +383,7 @@ void cmGlobalVisualStudio6Generator::WriteDSWHeader(std::ostream& fout)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string
|
std::string
|
||||||
cmGlobalVisualStudio6Generator::WriteUtilityDepend(cmTarget const* target)
|
cmGlobalVisualStudio6Generator::WriteUtilityDepend(const cmTarget *target)
|
||||||
{
|
{
|
||||||
std::string pname = target->GetName();
|
std::string pname = target->GetName();
|
||||||
pname += "_UTILITY";
|
pname += "_UTILITY";
|
||||||
|
@ -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,7 +92,7 @@ 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);
|
||||||
|
@ -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)->Target);
|
this->AddDSPBuildRule(*l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,21 +133,21 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
|
|||||||
case cmState::STATIC_LIBRARY:
|
case cmState::STATIC_LIBRARY:
|
||||||
case cmState::OBJECT_LIBRARY:
|
case cmState::OBJECT_LIBRARY:
|
||||||
this->SetBuildType(STATIC_LIBRARY,
|
this->SetBuildType(STATIC_LIBRARY,
|
||||||
(*l)->GetName().c_str(), *(*l)->Target);
|
(*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,
|
this->SetBuildType(DLL,
|
||||||
(*l)->GetName().c_str(), *(*l)->Target);
|
(*l)->GetName().c_str(), *l);
|
||||||
break;
|
break;
|
||||||
case cmState::EXECUTABLE:
|
case cmState::EXECUTABLE:
|
||||||
this->SetBuildType(EXECUTABLE,
|
this->SetBuildType(EXECUTABLE,
|
||||||
(*l)->GetName().c_str(), *(*l)->Target);
|
(*l)->GetName().c_str(), *l);
|
||||||
break;
|
break;
|
||||||
case cmState::UTILITY:
|
case cmState::UTILITY:
|
||||||
case cmState::GLOBAL_TARGET:
|
case cmState::GLOBAL_TARGET:
|
||||||
this->SetBuildType(UTILITY,
|
this->SetBuildType(UTILITY,
|
||||||
(*l)->GetName().c_str(), *(*l)->Target);
|
(*l)->GetName().c_str(), *l);
|
||||||
break;
|
break;
|
||||||
case cmState::INTERFACE_LIBRARY:
|
case cmState::INTERFACE_LIBRARY:
|
||||||
continue;
|
continue;
|
||||||
@ -173,7 +173,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
|
|||||||
cmSystemTools::Error("Error creating directory: ", dir.c_str());
|
cmSystemTools::Error("Error creating directory: ", dir.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->CreateSingleDSP((*l)->GetName().c_str(), *(*l)->Target);
|
this->CreateSingleDSP((*l)->GetName().c_str(), *l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,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);
|
||||||
@ -211,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());
|
||||||
@ -245,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
|
||||||
{
|
{
|
||||||
@ -257,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
|
||||||
@ -265,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());
|
||||||
@ -290,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);
|
||||||
}
|
}
|
||||||
@ -306,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;
|
||||||
}
|
}
|
||||||
@ -375,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.
|
||||||
@ -411,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.
|
||||||
@ -484,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";
|
||||||
|
|
||||||
@ -575,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())
|
||||||
{
|
{
|
||||||
@ -598,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
|
||||||
@ -715,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=
|
||||||
@ -747,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";
|
||||||
@ -799,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;
|
||||||
@ -833,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 "";
|
||||||
}
|
}
|
||||||
@ -847,10 +838,10 @@ 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->Target, configName, false));
|
||||||
if(pcc.get())
|
if(pcc.get())
|
||||||
{
|
{
|
||||||
event.Write(*pcc);
|
event.Write(*pcc);
|
||||||
@ -864,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";
|
||||||
@ -883,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;
|
||||||
@ -894,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)
|
||||||
@ -947,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;
|
||||||
@ -1061,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;
|
||||||
@ -1103,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.
|
||||||
@ -1197,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");
|
||||||
@ -1210,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");
|
||||||
@ -1223,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");
|
||||||
@ -1238,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1315,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();
|
||||||
@ -1334,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;
|
||||||
@ -1361,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";
|
||||||
@ -1398,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;
|
||||||
@ -1426,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:";
|
||||||
@ -1496,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");
|
||||||
@ -1515,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);
|
||||||
@ -1523,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);
|
||||||
@ -1545,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;
|
||||||
}
|
}
|
||||||
@ -1569,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());
|
||||||
@ -1676,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());
|
||||||
@ -1700,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 = " ";
|
||||||
@ -1710,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
|
||||||
@ -1752,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
|
||||||
@ -1777,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 = " ";
|
||||||
@ -1852,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;
|
||||||
@ -1919,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)
|
||||||
{
|
{
|
||||||
|
@ -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,7 +46,7 @@ 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;
|
||||||
@ -56,41 +55,42 @@ 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;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user