summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaNormalTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-06-09 13:18:28 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-06-09 13:18:28 (GMT)
commit8f3bd1f454fe50a641fd9666ca5e5bc8064c09c7 (patch)
tree3ebf192590c39f773008a005e4e00176ae063201 /Source/cmNinjaNormalTargetGenerator.cxx
parentc21397b2df9470bde02d19175e393110871cee91 (diff)
parentea59867187e8bdb8a7ffda37ad58e7f8493ebf7c (diff)
downloadCMake-8f3bd1f454fe50a641fd9666ca5e5bc8064c09c7.zip
CMake-8f3bd1f454fe50a641fd9666ca5e5bc8064c09c7.tar.gz
CMake-8f3bd1f454fe50a641fd9666ca5e5bc8064c09c7.tar.bz2
Merge topic 'ninja-no-ranlib-windows'
ea598671 Run ranlib on archives only if the tool is available
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 60eb904..fdce542 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -144,6 +144,14 @@ std::string cmNinjaNormalTargetGenerator::LanguageLinkerRule() const
this->GetGeneratorTarget()->GetName());
}
+struct cmNinjaRemoveNoOpCommands
+{
+ bool operator()(std::string const& cmd)
+ {
+ return cmd.empty() || cmd[0] == ':';
+ }
+};
+
void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
{
cmState::TargetType targetType = this->GetGeneratorTarget()->GetType();
@@ -231,6 +239,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
i != linkCmds.end(); ++i) {
this->GetLocalGenerator()->ExpandRuleVariables(*i, vars);
}
+ {
+ // If there is no ranlib the command will be ":". Skip it.
+ std::vector<std::string>::iterator newEnd = std::remove_if(
+ linkCmds.begin(), linkCmds.end(), cmNinjaRemoveNoOpCommands());
+ linkCmds.erase(newEnd, linkCmds.end());
+ }
+
linkCmds.insert(linkCmds.begin(), "$PRE_LINK");
linkCmds.push_back("$POST_BUILD");
std::string linkCmd =