summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/envvar/CMAKE_NO_VERBOSE.rst8
-rw-r--r--Help/envvar/VERBOSE.rst10
-rw-r--r--Help/manual/cmake-env-variables.7.rst2
-rw-r--r--Help/manual/cmake.1.rst8
-rw-r--r--Help/release/dev/cmake-build-verbose.rst6
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx9
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx4
-rw-r--r--Source/cmake.cxx9
-rw-r--r--Source/cmake.h3
-rw-r--r--Source/cmakemain.cxx9
10 files changed, 61 insertions, 7 deletions
diff --git a/Help/envvar/CMAKE_NO_VERBOSE.rst b/Help/envvar/CMAKE_NO_VERBOSE.rst
new file mode 100644
index 0000000..149efbd
--- /dev/null
+++ b/Help/envvar/CMAKE_NO_VERBOSE.rst
@@ -0,0 +1,8 @@
+CMAKE_NO_VERBOSE
+----------------
+
+Disables verbose output from CMake when :envvar:`VERBOSE` environment variable
+is set.
+
+Only your build tool of choice will still print verbose output when you start
+to actually build your project.
diff --git a/Help/envvar/VERBOSE.rst b/Help/envvar/VERBOSE.rst
new file mode 100644
index 0000000..2d775a5
--- /dev/null
+++ b/Help/envvar/VERBOSE.rst
@@ -0,0 +1,10 @@
+VERBOSE
+-------
+
+Activates verbose output from CMake and your build tools of choice when
+you start to actually build your project.
+
+Note that any given value is ignored. It's just checked for existence.
+
+See also :ref:`Build Tool Mode <Build Tool Mode>` and
+:envvar:`CMAKE_NO_VERBOSE` environment variable
diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst
index edf80f4..c433412 100644
--- a/Help/manual/cmake-env-variables.7.rst
+++ b/Help/manual/cmake-env-variables.7.rst
@@ -24,11 +24,13 @@ Environment Variables that Control the Build
/envvar/CMAKE_BUILD_PARALLEL_LEVEL
/envvar/CMAKE_CONFIG_TYPE
/envvar/CMAKE_MSVCIDE_RUN_PATH
+ /envvar/CMAKE_NO_VERBOSE
/envvar/CMAKE_OSX_ARCHITECTURES
/envvar/DESTDIR
/envvar/LDFLAGS
/envvar/MACOSX_DEPLOYMENT_TARGET
/envvar/PackageName_ROOT
+ /envvar/VERBOSE
Environment Variables for Languages
===================================
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 915e0d4..77178b8 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -289,6 +289,14 @@ following options:
``--use-stderr``
Ignored. Behavior is default in CMake >= 3.0.
+``-v, --verbose``
+ Enable verbose output - if supported - including the build commands to be
+ executed.
+
+ This option can be omitted if :envvar:`VERBOSE` environment variable or
+ :variable:`CMAKE_VERBOSE_MAKEFILE` cached variable is set.
+
+
``--``
Pass remaining options to the native tool.
diff --git a/Help/release/dev/cmake-build-verbose.rst b/Help/release/dev/cmake-build-verbose.rst
new file mode 100644
index 0000000..dee212e
--- /dev/null
+++ b/Help/release/dev/cmake-build-verbose.rst
@@ -0,0 +1,6 @@
+cmake-build-verbose
+-------------------
+
+* The :manual:`cmake(1)` :ref:`Build Tool Mode` (``cmake --build``) gained
+ ``--verbose`` and ``-v`` options to specify verbose build output. Some
+ generators such as Xcode don't support this option currently.
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 9fc60e7..6989b51 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -493,7 +493,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
GeneratedMakeCommand& makeCommand, const std::string& makeProgram,
const std::string& /*projectName*/, const std::string& /*projectDir*/,
const std::string& targetName, const std::string& /*config*/, bool fast,
- int jobs, bool /*verbose*/, std::vector<std::string> const& makeOptions)
+ int jobs, bool verbose, std::vector<std::string> const& makeOptions)
{
std::unique_ptr<cmMakefile> mfu;
cmMakefile* mf;
@@ -510,6 +510,13 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
mf = mfu.get();
}
+ // Make it possible to set verbosity also from command line
+ if (verbose) {
+ makeCommand.add(cmSystemTools::GetCMakeCommand());
+ makeCommand.add("-E");
+ makeCommand.add("env");
+ makeCommand.add("VERBOSE=1");
+ }
makeCommand.add(this->SelectMakeProgram(makeProgram));
if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 051ef18..60b2258 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -961,6 +961,10 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
makeCommand.add("/p:CL_MPCount=1");
}
+ // Respect the verbosity: 'n' normal will show build commands
+ // 'm' minimal only the build step's title
+ makeCommand.add(std::string("/v:") + ((verbose) ? "n" : "m"));
+
makeCommand.add(makeOptions.begin(), makeOptions.end());
}
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 914c3b0..411ba3a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2539,7 +2539,8 @@ cmMessenger* cmake::GetMessenger() const
int cmake::Build(int jobs, const std::string& dir, const std::string& target,
const std::string& config,
- const std::vector<std::string>& nativeOptions, bool clean)
+ const std::vector<std::string>& nativeOptions, bool clean,
+ bool verbose)
{
this->SetHomeDirectory("");
@@ -2592,11 +2593,11 @@ int cmake::Build(int jobs, const std::string& dir, const std::string& target,
return 1;
}
projName = cachedProjectName;
- bool verbose = false;
+
const char* cachedVerbose =
this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE");
- if (cachedVerbose) {
- verbose = cmSystemTools::IsOn(cachedVerbose);
+ if (cmSystemTools::IsOn(cachedVerbose)) {
+ verbose = true;
}
#ifdef CMAKE_HAVE_VS_GENERATORS
diff --git a/Source/cmake.h b/Source/cmake.h
index 9478ad0e..7ec1b64 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -430,7 +430,8 @@ public:
///! run the --build option
int Build(int jobs, const std::string& dir, const std::string& target,
const std::string& config,
- const std::vector<std::string>& nativeOptions, bool clean);
+ const std::vector<std::string>& nativeOptions, bool clean,
+ bool verbose);
///! run the --open option
bool Open(const std::string& dir, bool dryRun);
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 0c25498..0ec2552 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -68,6 +68,8 @@ static const char* cmDocumentationUsageNote[][2] = {
" --clean-first = Build target 'clean' first, then build.\n" \
" (To clean only, use --target 'clean'.)\n" \
" --use-stderr = Ignored. Behavior is default in CMake >= 3.0.\n" \
+ " -v --verbose = Enable verbose output - if supported - including\n" \
+ " the build commands to be executed. \n" \
" -- = Pass remaining options to the native tool.\n"
static const char* cmDocumentationOptions[][2] = {
@@ -395,6 +397,7 @@ static int do_build(int ac, char const* const* av)
std::string dir;
std::vector<std::string> nativeOptions;
bool clean = false;
+ bool verbose = cmSystemTools::HasEnv("VERBOSE");
bool hasTarget = false;
enum Doing
@@ -435,6 +438,10 @@ static int do_build(int ac, char const* const* av)
} else if (strcmp(av[i], "--clean-first") == 0) {
clean = true;
doing = DoingNone;
+ } else if ((strcmp(av[i], "--verbose") == 0) ||
+ (strcmp(av[i], "-v") == 0)) {
+ verbose = true;
+ doing = DoingNone;
} else if (strcmp(av[i], "--use-stderr") == 0) {
/* tolerate legacy option */
} else if (strcmp(av[i], "--") == 0) {
@@ -493,7 +500,7 @@ static int do_build(int ac, char const* const* av)
cmake cm(cmake::RoleInternal, cmState::Unknown);
cmSystemTools::SetMessageCallback(cmakemainMessageCallback, &cm);
cm.SetProgressCallback(cmakemainProgressCallback, &cm);
- return cm.Build(jobs, dir, target, config, nativeOptions, clean);
+ return cm.Build(jobs, dir, target, config, nativeOptions, clean, verbose);
#endif
}