summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Help/command/file.rst3
-rw-r--r--Help/command/install.rst4
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/release/dev/install-messages.rst5
-rw-r--r--Help/variable/CMAKE_INSTALL_MESSAGE.rst30
-rw-r--r--Source/cmInstallCommand.cxx8
-rw-r--r--Source/cmInstallFilesCommand.cxx2
-rw-r--r--Source/cmInstallGenerator.cxx28
-rw-r--r--Source/cmInstallGenerator.h7
-rw-r--r--Source/cmInstallProgramsCommand.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx2
-rw-r--r--Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake24
-rw-r--r--Tests/RunCMake/install/DIRECTORY-message-lazy.cmake3
-rw-r--r--Tests/RunCMake/install/DIRECTORY-message.cmake1
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake1
15 files changed, 113 insertions, 8 deletions
diff --git a/Help/command/file.rst b/Help/command/file.rst
index 869350a8f6..58e3a26f45 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -298,6 +298,7 @@ See the :command:`install(DIRECTORY)` command for documentation of
permissions, ``PATTERN``, ``REGEX``, and ``EXCLUDE`` options.
The ``INSTALL`` signature differs slightly from ``COPY``: it prints
-status messages, and ``NO_SOURCE_PERMISSIONS`` is default.
+status messages (subject to the :variable:`CMAKE_INSTALL_MESSAGE` variable),
+and ``NO_SOURCE_PERMISSIONS`` is default.
Installation scripts generated by the :command:`install` command
use this signature (with some undocumented options for internal use).
diff --git a/Help/command/install.rst b/Help/command/install.rst
index 462a8a9e6e..00f722b0c2 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -59,6 +59,10 @@ signatures that specify them. The common options are:
Specify that it is not an error if the file to be installed does
not exist.
+Command signatures that install files may print messages during
+installation. Use the :variable:`CMAKE_INSTALL_MESSAGE` variable
+to control which messages are printed.
+
Installing Targets
^^^^^^^^^^^^^^^^^^
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index df434c541f..0e4c4a062c 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -128,6 +128,7 @@ Variables that Change Behavior
/variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE
/variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE
/variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME
+ /variable/CMAKE_INSTALL_MESSAGE
/variable/CMAKE_INSTALL_PREFIX
/variable/CMAKE_LIBRARY_PATH
/variable/CMAKE_MFC_FLAG
diff --git a/Help/release/dev/install-messages.rst b/Help/release/dev/install-messages.rst
new file mode 100644
index 0000000000..c8aa456235
--- /dev/null
+++ b/Help/release/dev/install-messages.rst
@@ -0,0 +1,5 @@
+install-messages
+----------------
+
+* The :variable:`CMAKE_INSTALL_MESSAGE` variable was introduced to
+ optionally reduce output installation.
diff --git a/Help/variable/CMAKE_INSTALL_MESSAGE.rst b/Help/variable/CMAKE_INSTALL_MESSAGE.rst
new file mode 100644
index 0000000000..304df268c7
--- /dev/null
+++ b/Help/variable/CMAKE_INSTALL_MESSAGE.rst
@@ -0,0 +1,30 @@
+CMAKE_INSTALL_MESSAGE
+---------------------
+
+Specify verbosity of installation script code generated by the
+:command:`install` command (using the :command:`file(INSTALL)` command).
+For paths that are newly installed or updated, installation
+may print lines like::
+
+ -- Installing: /some/destination/path
+
+For paths that are already up to date, installation may print
+lines like::
+
+ -- Up-to-date: /some/destination/path
+
+The ``CMAKE_INSTALL_MESSAGE`` variable may be set to control
+which messages are printed:
+
+``ALWAYS``
+ Print both ``Installing`` and ``Up-to-date`` messages.
+
+``LAZY``
+ Print ``Installing`` but not ``Up-to-date`` messages.
+
+``NEVER``
+ Print neither ``Installing`` nor ``Up-to-date`` messages.
+
+Other values have undefined behavior and may not be diagnosed.
+
+If this variable is not set, the default behavior is ``ALWAYS``.
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index d0eea359b5..f4af460c6f 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -26,7 +26,7 @@ static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target,
const cmInstallCommandArguments& args, bool impLib, bool forceOpt = false)
{
cmInstallGenerator::MessageLevel message =
- cmInstallGenerator::MessageDefault;
+ cmInstallGenerator::SelectMessageLevel(target.GetMakefile());
return new cmInstallTargetGenerator(target, args.GetDestination().c_str(),
impLib, args.GetPermissions().c_str(),
args.GetConfigurations(), args.GetComponent().c_str(),
@@ -40,7 +40,7 @@ static cmInstallFilesGenerator* CreateInstallFilesGenerator(
const cmInstallCommandArguments& args, bool programs)
{
cmInstallGenerator::MessageLevel message =
- cmInstallGenerator::MessageDefault;
+ cmInstallGenerator::SelectMessageLevel(mf);
return new cmInstallFilesGenerator(mf,
absFiles, args.GetDestination().c_str(),
programs, args.GetPermissions().c_str(),
@@ -1215,7 +1215,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
}
cmInstallGenerator::MessageLevel message =
- cmInstallGenerator::MessageDefault;
+ cmInstallGenerator::SelectMessageLevel(this->Makefile);
// Create the directory install generator.
this->Makefile->AddInstallGenerator(
@@ -1344,7 +1344,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
}
cmInstallGenerator::MessageLevel message =
- cmInstallGenerator::MessageDefault;
+ cmInstallGenerator::SelectMessageLevel(this->Makefile);
// Create the export install generator.
cmInstallExportGenerator* exportGenerator =
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 1d648c9883..f106e1a808 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -133,7 +133,7 @@ void cmInstallFilesCommand::CreateInstallGenerator() const
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations;
cmInstallGenerator::MessageLevel message =
- cmInstallGenerator::MessageDefault;
+ cmInstallGenerator::SelectMessageLevel(this->Makefile);
this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(this->Makefile, this->Files,
destination.c_str(), false,
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 0bc40735d9..7c6c5aecca 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -11,6 +11,7 @@
============================================================================*/
#include "cmInstallGenerator.h"
+#include "cmMakefile.h"
#include "cmSystemTools.h"
//----------------------------------------------------------------------------
@@ -98,6 +99,13 @@ void cmInstallGenerator
{
os << " OPTIONAL";
}
+ switch(this->Message)
+ {
+ case MessageDefault: break;
+ case MessageAlways: os << " MESSAGE_ALWAYS"; break;
+ case MessageLazy: os << " MESSAGE_LAZY"; break;
+ case MessageNever: os << " MESSAGE_NEVER"; break;
+ }
if(permissions_file && *permissions_file)
{
os << " PERMISSIONS" << permissions_file;
@@ -182,3 +190,23 @@ std::string cmInstallGenerator::GetInstallDestination() const
result += this->Destination;
return result;
}
+
+//----------------------------------------------------------------------------
+cmInstallGenerator::MessageLevel
+cmInstallGenerator::SelectMessageLevel(cmMakefile* mf)
+{
+ std::string m = mf->GetSafeDefinition("CMAKE_INSTALL_MESSAGE");
+ if(m == "ALWAYS")
+ {
+ return MessageAlways;
+ }
+ if(m == "LAZY")
+ {
+ return MessageLazy;
+ }
+ if(m == "NEVER")
+ {
+ return MessageNever;
+ }
+ return MessageDefault;
+}
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index 8e8db40177..e32276facc 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -16,6 +16,7 @@
#include "cmScriptGenerator.h"
class cmLocalGenerator;
+class cmMakefile;
/** \class cmInstallGenerator
* \brief Support class for generating install scripts.
@@ -27,6 +28,9 @@ public:
enum MessageLevel
{
MessageDefault,
+ MessageAlways,
+ MessageLazy,
+ MessageNever
};
cmInstallGenerator(const char* destination,
@@ -56,6 +60,9 @@ public:
/** Test if this generator installs something for a given configuration. */
bool InstallsForConfig(const std::string& config);
+ /** Select message level from CMAKE_INSTALL_MESSAGE. */
+ static MessageLevel SelectMessageLevel(cmMakefile* mf);
+
protected:
virtual void GenerateScript(std::ostream& os);
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 18d7546b31..0405769bbf 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -94,7 +94,7 @@ void cmInstallProgramsCommand::FinalPass()
"CMAKE_INSTALL_DEFAULT_COMPONENT_NAME");
std::vector<std::string> no_configurations;
cmInstallGenerator::MessageLevel message =
- cmInstallGenerator::MessageDefault;
+ cmInstallGenerator::SelectMessageLevel(this->Makefile);
this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(this->Makefile, this->Files,
destination.c_str(), true,
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ec89bdeae7..a1dbaa5e65 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3004,7 +3004,7 @@ public:
cmInstallTargetGeneratorLocal(cmTarget& t, const char* dest, bool implib):
cmInstallTargetGenerator(
t, dest, implib, "", std::vector<std::string>(), "Unspecified",
- MessageDefault,
+ cmInstallGenerator::SelectMessageLevel(t.GetMakefile()),
false) {}
};
diff --git a/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake b/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake
new file mode 100644
index 0000000000..c7e6018803
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake
@@ -0,0 +1,24 @@
+file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix)
+execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_VARIABLE out ERROR_VARIABLE err)
+set(expect "
+-- Installing: [^\n]*/prefix/dir\r?
+-- Installing: [^\n]*/prefix/dir/empty.txt\r?
+")
+if(NOT out MATCHES "${expect}")
+ string(REGEX REPLACE "\n" "\n " out " ${out}")
+ set(RunCMake_TEST_FAILED
+ "${RunCMake_TEST_FAILED}First install did not say 'Installing' as expected:\n${out}")
+endif()
+set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt)
+if(NOT EXISTS "${f}")
+ set(RunCMake_TEST_FAILED
+ "${RunCMake_TEST_FAILED}File was not installed:\n ${f}\n")
+endif()
+execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_VARIABLE out ERROR_VARIABLE err)
+if(out MATCHES "(Installing|Up-to-date)")
+ string(REGEX REPLACE "\n" "\n " out " ${out}")
+ set(RunCMake_TEST_FAILED
+ "${RunCMake_TEST_FAILED}Second install was not silent as expected:\n${out}")
+endif()
diff --git a/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake b/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake
new file mode 100644
index 0000000000..ed4356714a
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_INSTALL_MESSAGE "LAZY")
+set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix")
+install(DIRECTORY dir/ DESTINATION dir)
diff --git a/Tests/RunCMake/install/DIRECTORY-message.cmake b/Tests/RunCMake/install/DIRECTORY-message.cmake
index 548e0df2d3..913ed157de 100644
--- a/Tests/RunCMake/install/DIRECTORY-message.cmake
+++ b/Tests/RunCMake/install/DIRECTORY-message.cmake
@@ -1,2 +1,3 @@
+set(CMAKE_INSTALL_MESSAGE "ALWAYS")
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix")
install(DIRECTORY dir/ DESTINATION dir)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index 39d2c1db75..8016801719 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -1,5 +1,6 @@
include(RunCMake)
run_cmake(DIRECTORY-message)
+run_cmake(DIRECTORY-message-lazy)
run_cmake(SkipInstallRulesWarning)
run_cmake(SkipInstallRulesNoWarning1)
run_cmake(SkipInstallRulesNoWarning2)