Dear CMake developers, I am annoyed by the lengthy and disturbing warning CMake emits when a package is not found because neither a Find*.cmake file is found nor a *config.cmake file. I always try to have zero warnings, but missing dependencies is common. Emitting a warning is too much and too noisy in my opinion.
Please find attached patch, which reduces the warning to a single line with the status that the package was not found. Bye Christoph -- However, the occasional visit of success provides just the excitement an engineer needs to face work the following day. [Koichi Tanaka]
>From c18afe5f54fe9560670f72bb79f500d231ca95f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <f...@grueninger.de> Date: Tue, 9 Aug 2016 22:25:03 +0200 Subject: [PATCH] Don't emit warning when config file not found --- Source/cmFindPackageCommand.cxx | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 260079b..33d7e81 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -658,6 +658,7 @@ bool cmFindPackageCommand::HandlePackageMode() // The variable is not set. std::ostringstream e; std::ostringstream aw; + std::ostringstream msg; if (configFileSetFOUNDFalse) { /* clang-format off */ e << "Found package configuration file:\n" @@ -695,33 +696,17 @@ bool cmFindPackageCommand::HandlePackageMode() if (this->UseConfigFiles) { if (this->UseFindModules) { - e << "By not providing \"Find" << this->Name - << ".cmake\" in " - "CMAKE_MODULE_PATH this project has asked CMake to find a " - "package configuration file provided by \"" - << this->Name << "\", " - "but CMake did not find one.\n"; + msg << "-- Could NOT find " << this->Name; } if (this->Configs.size() == 1) { - e << "Could not find a package configuration file named \"" - << this->Configs[0] << "\" provided by package \"" << this->Name - << "\"" << requestedVersionString << ".\n"; + msg << "(missing package configuration file named \"" + << this->Configs[0] << ")" << "\n"; } else { - e << "Could not find a package configuration file provided by \"" - << this->Name << "\"" << requestedVersionString - << " with any of the following names:\n" - << cmWrap(" ", this->Configs, "", "\n") << "\n"; + msg << " (CMAKE_MODULE_PATH does not contain any of these files: Find" + << this->Name << ".cmake" + << cmWrap(", ", this->Configs, "", "") << ")\n"; } - - e << "Add the installation prefix of \"" << this->Name - << "\" to " - "CMAKE_PREFIX_PATH or set \"" - << this->Variable << "\" to a " - "directory containing one of the above files. " - "If \"" - << this->Name << "\" provides a separate development " - "package or SDK, be sure it has been installed."; } else // if(!this->UseFindModules && !this->UseConfigFiles) { e << "No \"Find" << this->Name << ".cmake\" found in " @@ -744,15 +729,15 @@ bool cmFindPackageCommand::HandlePackageMode() } } - this->Makefile->IssueMessage( - this->Required ? cmake::FATAL_ERROR : cmake::WARNING, e.str()); if (this->Required) { + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); cmSystemTools::SetFatalErrorOccured(); } - - if (!aw.str().empty()) { - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, aw.str()); + else if (!e.str().empty()) { + this->Makefile->IssueMessage(cmake::WARNING, e.str()); } + + std::cout << msg.str(); } // Set a variable marking whether the package was found. -- 2.6.6
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers