Commit d0b9d1cc authored by Christoph Grüninger's avatar Christoph Grüninger Committed by Brad King

find_package: shorten output for missing package in config mode

If CONFIG or MODULE is given and the package is not REQUIRED,
output a one-liner instead of the full warning.

Update Tests/RunCMake/find_package expected output to match.
parent d9df805f
......@@ -729,8 +729,9 @@ bool cmFindPackageCommand::HandlePackageMode()
// package not found
if (result && !found) {
// warn if package required and not quiet
if (!this->Quiet || this->Required) {
// warn if package required or neither quiet nor in config mode
if (this->Required ||
!(this->Quiet || (this->UseConfigFiles && !this->UseFindModules))) {
// The variable is not set.
std::ostringstream e;
std::ostringstream aw;
......@@ -832,6 +833,13 @@ bool cmFindPackageCommand::HandlePackageMode()
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, aw.str());
}
}
// output result if in config mode but not in quiet mode
else if (!this->Quiet) {
std::ostringstream aw;
aw << "Could NOT find " << this->Name << " (missing: " << this->Name
<< "_DIR)";
this->Makefile->DisplayStatus(aw.str().c_str(), -1);
}
}
// Set a variable marking whether the package was found.
......
CMake Warning at MissingConfig.cmake:1 \(find_package\):
Could not find a package configuration file provided by "NotHere" with any
of the following names:
NotHereConfig.cmake
nothere-config.cmake
Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
"NotHere_DIR" to a directory containing one of the above files. If
"NotHere" provides a separate development package or SDK, be sure it has
been installed.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
CMake Warning at MissingConfig.cmake:2 \(message\):
This warning must be reachable.
Call Stack \(most recent call first\):
......
-- Could NOT find NotHere \(missing: NotHere_DIR\)
-- Could NOT find NotHere \(missing: NotHere_DIR\)
CMake Warning at MissingConfigOneName.cmake:1 \(find_package\):
Could not find a package configuration file named "NotHereConfig.cmake"
provided by package "NotHere".
Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
"NotHere_DIR" to a directory containing one of the above files. If
"NotHere" provides a separate development package or SDK, be sure it has
been installed.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
-- Could NOT find NotHere \(missing: NotHere_DIR\)
CMake Warning at MissingConfigVersion.cmake:1 \(find_package\):
Could not find a package configuration file provided by "NotHere"
\(requested version 1\.2\) with any of the following names:
NotHereConfig.cmake
nothere-config.cmake
Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
"NotHere_DIR" to a directory containing one of the above files. If
"NotHere" provides a separate development package or SDK, be sure it has
been installed.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
-- Could NOT find NotHere \(missing: NotHere_DIR\)
CMake Warning at SetFoundFALSE.cmake:2 \(find_package\):
Found package configuration file:
.*/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake
but it set SetFoundFALSE_FOUND to FALSE so package "SetFoundFALSE" is
considered to be NOT FOUND.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
-- Could NOT find SetFoundFALSE \(missing: SetFoundFALSE_DIR\)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment