[cmake-developers] [PATCH] Pass CMAKE_VERBOSE_MAKEFILE value to Ninja Generator
Gregor Jasny
gjasny at googlemail.com
Wed Feb 25 16:24:06 EST 2015
Ninja build system does not support a in-Makefile verbositiy
switch. So we use cmake --build as a fall back to extract the
CMAKE_VERBOSE_MAKEFILE property and pass it as an optional
-v argument to Ninja.
Signed-off-by: Gregor Jasny <gjasny at googlemail.com>
---
Source/cmGlobalGenerator.cxx | 2 ++
Source/cmGlobalGenerator.h | 5 +++++
Source/cmGlobalNinjaGenerator.cxx | 5 +++++
Source/cmake.cxx | 5 +++++
4 files changed, 17 insertions(+)
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 6147009..0a4e60a 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -69,6 +69,8 @@ cmGlobalGenerator::cmGlobalGenerator()
this->ExtraGenerator = 0;
this->CurrentLocalGenerator = 0;
this->TryCompileOuterMakefile = 0;
+
+ this->VerboseBuild = false;
}
cmGlobalGenerator::~cmGlobalGenerator()
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 08f061a..1e948f3 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -349,6 +349,9 @@ public:
std::set<cmTarget const*> const&
GetFilenameTargetDepends(cmSourceFile* sf) const;
+ void SetVerboseBuild(bool verbose) { this->VerboseBuild = verbose; }
+ bool GetVerboseBuild() const { return this->VerboseBuild; }
+
#if defined(CMAKE_BUILD_WITH_CMAKE)
cmFileLockPool& GetFileLockPool() { return FileLockPool; }
#endif
@@ -506,6 +509,8 @@ private:
mutable std::map<cmSourceFile*, std::set<cmTarget const*> >
FilenameTargetDepends;
+ bool VerboseBuild;
+
#if defined(CMAKE_BUILD_WITH_CMAKE)
// Pool of file locks
cmFileLockPool FileLockPool;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 3c07be1..850f891 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -580,6 +580,11 @@ void cmGlobalNinjaGenerator
this->SelectMakeProgram(makeProgram)
);
+ if(GetVerboseBuild())
+ {
+ makeCommand.push_back("-v");
+ }
+
makeCommand.insert(makeCommand.end(),
makeOptions.begin(), makeOptions.end());
if(!targetName.empty())
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 47be481..19835c4 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2789,6 +2789,11 @@ int cmake::Build(const std::string& dir,
return 1;
}
projName = it.GetValue();
+ if(it.Find("CMAKE_VERBOSE_MAKEFILE"))
+ {
+ bool verboseBuild = it.GetValueAsBool();
+ gen->SetVerboseBuild(verboseBuild);
+ }
return gen->Build("", dir,
projName, target,
output,
--
2.3.0
More information about the cmake-developers
mailing list