diff options
-rw-r--r-- | Help/command/install.rst | 4 | ||||
-rw-r--r-- | Help/release/dev/install-messages.rst | 3 | ||||
-rw-r--r-- | Source/cmInstallCommand.cxx | 18 | ||||
-rw-r--r-- | Source/cmInstallGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmInstallGenerator.h | 4 | ||||
-rw-r--r-- | Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake | 13 | ||||
-rw-r--r-- | Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/install/RunCMakeTest.cmake | 2 |
11 files changed, 54 insertions, 5 deletions
diff --git a/Help/command/install.rst b/Help/command/install.rst index 00f722b..4c52abf 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -196,7 +196,7 @@ Installing Directories install(DIRECTORY dirs... DESTINATION <dir> [FILE_PERMISSIONS permissions...] [DIRECTORY_PERMISSIONS permissions...] - [USE_SOURCE_PERMISSIONS] [OPTIONAL] + [USE_SOURCE_PERMISSIONS] [OPTIONAL] [MESSAGE_NEVER] [CONFIGURATIONS [Debug|Release|...]] [COMPONENT <component>] [FILES_MATCHING] [[PATTERN <pattern> | REGEX <regex>] @@ -219,6 +219,8 @@ permissions specified in the ``FILES`` form of the command, and the directories will be given the default permissions specified in the ``PROGRAMS`` form of the command. +The ``MESSAGE_NEVER`` option disables file installation status output. + Installation of directories may be controlled with fine granularity using the ``PATTERN`` or ``REGEX`` options. These "match" options specify a globbing pattern or regular expression to match directories or files diff --git a/Help/release/dev/install-messages.rst b/Help/release/dev/install-messages.rst index c8aa456..e023ef7 100644 --- a/Help/release/dev/install-messages.rst +++ b/Help/release/dev/install-messages.rst @@ -1,5 +1,8 @@ install-messages ---------------- +* The :command:`install` command learned a ``MESSAGE_NEVER`` option + to avoid output during installation. + * The :variable:`CMAKE_INSTALL_MESSAGE` variable was introduced to optionally reduce output installation. diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index f4af460..ec500d9 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -917,6 +917,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) Doing doing = DoingDirs; bool in_match_mode = false; bool optional = false; + bool message_never = false; std::vector<std::string> dirs; const char* destination = 0; std::string permissions_file; @@ -955,6 +956,21 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) optional = true; doing = DoingNone; } + else if(args[i] == "MESSAGE_NEVER") + { + if(in_match_mode) + { + cmOStringStream e; + e << args[0] << " does not allow \"" + << args[i] << "\" after PATTERN or REGEX."; + this->SetError(e.str()); + return false; + } + + // Mark the rule as quiet. + message_never = true; + doing = DoingNone; + } else if(args[i] == "PATTERN") { // Switch to a new pattern match rule. @@ -1215,7 +1231,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) } cmInstallGenerator::MessageLevel message = - cmInstallGenerator::SelectMessageLevel(this->Makefile); + cmInstallGenerator::SelectMessageLevel(this->Makefile, message_never); // Create the directory install generator. this->Makefile->AddInstallGenerator( diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 7c6c5ae..b261cbf 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -193,8 +193,12 @@ std::string cmInstallGenerator::GetInstallDestination() const //---------------------------------------------------------------------------- cmInstallGenerator::MessageLevel -cmInstallGenerator::SelectMessageLevel(cmMakefile* mf) +cmInstallGenerator::SelectMessageLevel(cmMakefile* mf, bool never) { + if(never) + { + return MessageNever; + } std::string m = mf->GetSafeDefinition("CMAKE_INSTALL_MESSAGE"); if(m == "ALWAYS") { diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index e32276f..38aac91 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -60,8 +60,8 @@ 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); + /** Select message level from CMAKE_INSTALL_MESSAGE or 'never'. */ + static MessageLevel SelectMessageLevel(cmMakefile* mf, bool never = false); protected: virtual void GenerateScript(std::ostream& os); diff --git a/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake new file mode 100644 index 0000000..2c716e1 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake @@ -0,0 +1,13 @@ +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) +if(out MATCHES "-- Installing: [^\n]*prefix/dir") + string(REGEX REPLACE "\n" "\n " out " ${out}") + set(RunCMake_TEST_FAILED + "${RunCMake_TEST_FAILED}Installation output was not quiet:\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() diff --git a/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake new file mode 100644 index 0000000..eefb837 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake @@ -0,0 +1,3 @@ +set(CMAKE_INSTALL_MESSAGE "ALWAYS") +set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix") +install(DIRECTORY dir/ DESTINATION dir MESSAGE_NEVER) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt new file mode 100644 index 0000000..166ba6f --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at DIRECTORY-PATTERN-MESSAGE_NEVER.cmake:[0-9]+ \(install\): + install DIRECTORY does not allow "MESSAGE_NEVER" after PATTERN or REGEX. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake new file mode 100644 index 0000000..de844f7 --- /dev/null +++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake @@ -0,0 +1 @@ +install(DIRECTORY src DESTINATION src PATTERN *.txt MESSAGE_NEVER) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 8016801..53b91f3 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -1,4 +1,6 @@ include(RunCMake) +run_cmake(DIRECTORY-MESSAGE_NEVER) +run_cmake(DIRECTORY-PATTERN-MESSAGE_NEVER) run_cmake(DIRECTORY-message) run_cmake(DIRECTORY-message-lazy) run_cmake(SkipInstallRulesWarning) |