summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileExecutableTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmMakefileExecutableTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx91
1 files changed, 56 insertions, 35 deletions
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 69b8092..fc52ccc 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -129,7 +129,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
}
}
- std::string pdbOutputPath = this->Target->GetPDBDirectory();
+ std::string compilePdbOutputPath =
+ this->Target->GetCompilePDBDirectory(this->ConfigName);
+ cmSystemTools::MakeDirectory(compilePdbOutputPath.c_str());
+
+ std::string pdbOutputPath = this->Target->GetPDBDirectory(this->ConfigName);
cmSystemTools::MakeDirectory(pdbOutputPath.c_str());
pdbOutputPath += "/";
@@ -138,32 +142,32 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string targetFullPathPDB = pdbOutputPath + targetNamePDB;
std::string targetFullPathImport = outpathImp + targetNameImport;
std::string targetOutPathPDB =
- this->Convert(targetFullPathPDB.c_str(),
+ this->Convert(targetFullPathPDB,
cmLocalGenerator::NONE,
cmLocalGenerator::SHELL);
// Convert to the output path to use in constructing commands.
std::string targetOutPath =
- this->Convert(targetFullPath.c_str(),
+ this->Convert(targetFullPath,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);
std::string targetOutPathReal =
- this->Convert(targetFullPathReal.c_str(),
+ this->Convert(targetFullPathReal,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);
std::string targetOutPathImport =
- this->Convert(targetFullPathImport.c_str(),
+ this->Convert(targetFullPathImport,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);
// Get the language to use for linking this executable.
- const char* linkLanguage =
+ std::string linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
// Make sure we have a link language.
- if(!linkLanguage)
+ if(linkLanguage.empty())
{
cmSystemTools::Error("Cannot determine link language for target \"",
- this->Target->GetName(), "\".");
+ this->Target->GetName().c_str(), "\".");
return;
}
@@ -206,7 +210,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
export_flag_var += linkLanguage;
export_flag_var += "_FLAG";
this->LocalGenerator->AppendFlags
- (linkFlags, this->Makefile->GetDefinition(export_flag_var.c_str()));
+ (linkFlags, this->Makefile->GetDefinition(export_flag_var));
}
// Add language feature flags.
@@ -221,14 +225,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string linkFlagsConfig = "LINK_FLAGS_";
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
this->LocalGenerator->AppendFlags
- (linkFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
+ (linkFlags, this->Target->GetProperty(linkFlagsConfig));
this->AddModuleDefinitionFlag(linkFlags);
// Construct a list of files associated with this executable that
// may need to be cleaned.
std::vector<std::string> exeCleanFiles;
- exeCleanFiles.push_back(this->Convert(targetFullPath.c_str(),
+ exeCleanFiles.push_back(this->Convert(targetFullPath,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
#ifdef _WIN32
@@ -240,19 +244,19 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
#endif
if(targetNameReal != targetName)
{
- exeCleanFiles.push_back(this->Convert(targetFullPathReal.c_str(),
+ exeCleanFiles.push_back(this->Convert(targetFullPathReal,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
}
if(!targetNameImport.empty())
{
- exeCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(),
+ exeCleanFiles.push_back(this->Convert(targetFullPathImport,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
std::string implib;
if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib))
{
- exeCleanFiles.push_back(this->Convert(implib.c_str(),
+ exeCleanFiles.push_back(this->Convert(implib,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
}
@@ -262,7 +266,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// cleaned. We do not want to delete the .pdb file just before
// linking the target.
this->CleanFiles.push_back
- (this->Convert(targetFullPathPDB.c_str(),
+ (this->Convert(targetFullPathPDB,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED));
@@ -285,7 +289,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string linkRuleVar = "CMAKE_";
linkRuleVar += linkLanguage;
linkRuleVar += "_LINK_EXECUTABLE";
- std::string linkRule = this->GetLinkRule(linkRuleVar.c_str());
+ std::string linkRule = this->GetLinkRule(linkRuleVar);
std::vector<std::string> commands1;
cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
if(this->Target->IsExecutableWithExports())
@@ -296,54 +300,71 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
implibRuleVar += linkLanguage;
implibRuleVar += "_CREATE_IMPORT_LIBRARY";
if(const char* rule =
- this->Makefile->GetDefinition(implibRuleVar.c_str()))
+ this->Makefile->GetDefinition(implibRuleVar))
{
cmSystemTools::ExpandListArgument(rule, real_link_commands);
}
}
// Select whether to use a response file for objects.
- bool useResponseFile = false;
+ bool useResponseFileForObjects = false;
{
std::string responseVar = "CMAKE_";
responseVar += linkLanguage;
responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS";
- if(this->Makefile->IsOn(responseVar.c_str()))
+ if(this->Makefile->IsOn(responseVar))
+ {
+ useResponseFileForObjects = true;
+ }
+ }
+
+ // Select whether to use a response file for libraries.
+ bool useResponseFileForLibs = false;
+ {
+ std::string responseVar = "CMAKE_";
+ responseVar += linkLanguage;
+ responseVar += "_USE_RESPONSE_FILE_FOR_LIBRARIES";
+ if(this->Makefile->IsOn(responseVar))
{
- useResponseFile = true;
+ useResponseFileForLibs = true;
}
}
// Expand the rule variables.
{
+ bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE");
+
// Set path conversion for link script shells.
this->LocalGenerator->SetLinkScriptShell(useLinkScript);
// Collect up flags to link in needed libraries.
std::string linkLibs;
- std::string frameworkPath;
- std::string linkPath;
- this->LocalGenerator->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
- *this->GeneratorTarget,
- relink);
- linkLibs = frameworkPath + linkPath + linkLibs;
+ this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends,
+ useWatcomQuote);
+
// Construct object file lists that may be needed to expand the
// rule.
std::string buildObjs;
- this->CreateObjectLists(useLinkScript, false, useResponseFile,
- buildObjs, depends);
+ this->CreateObjectLists(useLinkScript, false,
+ useResponseFileForObjects, buildObjs, depends,
+ useWatcomQuote);
cmLocalGenerator::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_LINK";
vars.CMTarget = this->Target;
- vars.Language = linkLanguage;
+ vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->Target->GetSupportDirectory();
- objectDir = this->Convert(objectDir.c_str(),
+ objectDir = this->Convert(objectDir,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);
vars.ObjectDir = objectDir.c_str();
- vars.Target = targetOutPathReal.c_str();
+ cmLocalGenerator::OutputFormat output = (useWatcomQuote) ?
+ cmLocalGenerator::WATCOMQUOTE : cmLocalGenerator::SHELL;
+ std::string target = this->Convert(targetFullPathReal,
+ cmLocalGenerator::START_OUTPUT,
+ output);
+ vars.Target = target.c_str();
vars.TargetPDB = targetOutPathPDB.c_str();
// Setup the target version.
@@ -425,7 +446,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// Write the build rule.
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream,
0,
- targetFullPathReal.c_str(),
+ targetFullPathReal,
depends, commands, false);
// The symlink name for the target should depend on the real target
@@ -435,14 +456,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
{
depends.clear();
commands.clear();
- depends.push_back(targetFullPathReal.c_str());
+ depends.push_back(targetFullPathReal);
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
- targetFullPath.c_str(),
+ targetFullPath,
depends, commands, false);
}
// Write the main driver rule to build everything in this target.
- this->WriteTargetDriverRule(targetFullPath.c_str(), relink);
+ this->WriteTargetDriverRule(targetFullPath, relink);
// Clean all the possible executable names and symlinks.
this->CleanFiles.insert(this->CleanFiles.end(),