summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-06-19 18:42:41 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-06-19 18:42:41 (GMT)
commit565744bd3db6f730a31e0325a1c7336224237d12 (patch)
treebf231f1aafe422fa60fd4fcba4a9e180a718d221 /Source/cmGlobalNinjaGenerator.cxx
parent8d198a71fc157343de56b0addcd987681639c127 (diff)
parenteb410e8dd8f4d1401d11713f398d38e0f250b136 (diff)
downloadCMake-565744bd3db6f730a31e0325a1c7336224237d12.zip
CMake-565744bd3db6f730a31e0325a1c7336224237d12.tar.gz
CMake-565744bd3db6f730a31e0325a1c7336224237d12.tar.bz2
Merge topic 'ninja-cldeps'
eb410e8 Ninja: disable cldeps for bcc32, it's too old, and ninja would also not build 5ead31d Ninja: try work around for bcc32 bug 1333b57 Ninja: build server fixes 9081e3a remove warning about unused parameter f430bea Ninja: maybe this fixes the bcc32 build f2c1288 Ninja: msvc6 for-scoping 44b9bbc Ninja: build with old msvc versions 57156a5 Ninja: build server fixes f1abdce Ninja: some bytes of the rc files couldn't be piped correctly 2de963d Ninja: don't remove space between command and parameters 50b6f33 Ninja: build cmcldeps with mingw c05653e Ninja: try to make GetProcessId visible ab245ff Ninja: but cl supports /nologo ... bf58e9a Ninja: no /nologo option in old rc.exe 2fb07fc Ninja: Eclipse and KDevelop fixes for ninja 518c065 Ninja: don't pollute build dir with preprocessed rc files ...
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx35
1 files changed, 26 insertions, 9 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 4d986ef..c3989c0 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -43,12 +43,13 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
std::string replace = comment;
std::string::size_type lpos = 0;
std::string::size_type rpos;
+ os << "\n#############################################\n";
while((rpos = replace.find('\n', lpos)) != std::string::npos)
{
os << "# " << replace.substr(lpos, rpos - lpos) << "\n";
lpos = rpos + 1;
}
- os << "# " << replace.substr(lpos) << "\n";
+ os << "# " << replace.substr(lpos) << "\n\n";
}
static bool IsIdentChar(char c)
@@ -176,7 +177,8 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
// check if a response file rule should be used
const std::string args = arguments.str();
- if (cmdLineLimit > 0 && args.size() > (size_t)cmdLineLimit)
+ if (cmdLineLimit > 0 &&
+ (args.size() + + builds.str().size()) > (size_t)cmdLineLimit)
builds << "_RSPFILE";
os << builds.str() << args;
@@ -318,6 +320,8 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
cmGlobalNinjaGenerator::Indent(os, 1);
os << "generator = 1\n";
}
+
+ os << "\n";
}
void cmGlobalNinjaGenerator::WriteVariable(std::ostream& os,
@@ -380,6 +384,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
this->FindMakeProgramFile = "CMakeNinjaFindMake.cmake";
}
+
//----------------------------------------------------------------------------
// Virtual public methods.
@@ -458,9 +463,8 @@ void cmGlobalNinjaGenerator
else if(*l == "RC")
{
// check if mingw is used
- const char* cc = mf->GetDefinition("CMAKE_C_COMPILER");
- if(cc && std::string(cc).find("gcc.exe") != std::string::npos)
- {
+ if(mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
+ {
UsingMinGW = true;
std::string rc = cmSystemTools::FindProgram("windres");
if(rc.empty())
@@ -470,7 +474,7 @@ void cmGlobalNinjaGenerator
}
this->cmGlobalGenerator::EnableLanguage(language, mf, optional);
this->ResolveLanguageCompiler(*l, mf, optional);
- }
+ }
}
bool cmGlobalNinjaGenerator::UsingMinGW = false;
@@ -538,7 +542,9 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& name,
{
// Do not add the same rule twice.
if (this->HasRule(name))
+ {
return;
+ }
this->Rules.insert(name);
cmGlobalNinjaGenerator::WriteRule(*this->RulesFileStream,
@@ -818,7 +824,7 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
// Insert the alias into the map. If the alias was already present in the
// map and referred to another target, mark it as ambiguous.
std::pair<TargetAliasMap::iterator, bool> newAlias =
- TargetAliases.insert(make_pair(alias, target));
+ TargetAliases.insert(std::make_pair(alias, target));
if (newAlias.second && newAlias.first->second != target)
newAlias.first->second = 0;
}
@@ -922,11 +928,22 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
cmNinjaDeps());
}
+std::string cmGlobalNinjaGenerator::ninjaCmd() const
+{
+ cmLocalGenerator* lgen = this->LocalGenerators[0];
+ if (lgen) {
+ return lgen->ConvertToOutputFormat(
+ lgen->GetMakefile()->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"),
+ cmLocalGenerator::SHELL);
+ }
+ return "ninja";
+}
+
void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
{
WriteRule(*this->RulesFileStream,
"CLEAN",
- "ninja -t clean",
+ (ninjaCmd() + " -t clean").c_str(),
"Cleaning all built files...",
"Rule for cleaning all built files.",
/*depfile=*/ "",
@@ -947,7 +964,7 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os)
{
WriteRule(*this->RulesFileStream,
"HELP",
- "ninja -t targets",
+ (ninjaCmd() + " -t tagets").c_str(),
"All primary targets available:",
"Rule for printing all primary targets available.",
/*depfile=*/ "",