summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaNormalTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-18 17:31:11 (GMT)
committerBrad King <brad.king@kitware.com>2015-05-18 19:01:06 (GMT)
commita390de65e09e3ebc496fc14d40848ea4940cc9b0 (patch)
treef8d2c58ba7b46117e408af8378cfd79a3e370f5f /Source/cmNinjaNormalTargetGenerator.cxx
parent00ccfff2bc06e640a185fb3d628ac36ea0b0fe9a (diff)
downloadCMake-a390de65e09e3ebc496fc14d40848ea4940cc9b0.zip
CMake-a390de65e09e3ebc496fc14d40848ea4940cc9b0.tar.gz
CMake-a390de65e09e3ebc496fc14d40848ea4940cc9b0.tar.bz2
Ninja: Generate separate compile and link rules for each target
Our <LANG>_COMPILER and <LANG>_<TARGET_TYPE>_LINKER rule generation has access to a specific cmTarget so the results may depend on it. Instead generate separate rules for each target using an encoded target name. In particular, this makes CTEST_USE_LAUNCHERS report proper target information.
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 771ecc4..7f9c09f 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -94,8 +94,6 @@ void cmNinjaNormalTargetGenerator::Generate()
}
else
{
- this->WriteLinkRule(false); // write rule without rspfile support
- this->WriteLinkRule(true); // write rule with rspfile support
this->WriteLinkStatement();
}
}
@@ -160,7 +158,9 @@ cmNinjaNormalTargetGenerator
return this->TargetLinkLanguage
+ "_"
+ cmTarget::GetTargetTypeName(this->GetTarget()->GetType())
- + "_LINKER";
+ + "_LINKER__"
+ + cmGlobalNinjaGenerator::EncodeRuleName(this->GetTarget()->GetName())
+ ;
}
void
@@ -169,8 +169,6 @@ cmNinjaNormalTargetGenerator
{
cmTarget::TargetType targetType = this->GetTarget()->GetType();
std::string ruleName = this->LanguageLinkerRule();
- if (useResponseFile)
- ruleName += "_RSP_FILE";
// Select whether to use a response file for objects.
std::string rspfile;
@@ -661,6 +659,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
}
// Write the build statement for this target.
+ bool usedResponseFile = false;
globalGen.WriteBuild(this->GetBuildFileStream(),
comment.str(),
this->LanguageLinkerRule(),
@@ -670,7 +669,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
orderOnlyDeps,
vars,
rspfile,
- commandLineLengthLimit);
+ commandLineLengthLimit,
+ &usedResponseFile);
+ this->WriteLinkRule(usedResponseFile);
if (targetOutput != targetOutputReal && !target.IsFrameworkOnApple())
{