summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2019-08-05 21:46:54 (GMT)
committerBrad King <brad.king@kitware.com>2019-08-06 13:36:36 (GMT)
commit8ed868606ddae005b4a50319bdc291b8df5b525a (patch)
tree3733d5eb155f5497f8c05e475f985eace9b46b69 /Source/cmFindPackageCommand.cxx
parentf43a7d76c737c5bb9b903a2b1be5186c081ec21e (diff)
downloadCMake-8ed868606ddae005b4a50319bdc291b8df5b525a.zip
CMake-8ed868606ddae005b4a50319bdc291b8df5b525a.tar.gz
CMake-8ed868606ddae005b4a50319bdc291b8df5b525a.tar.bz2
find_package: Fix prefer-config mode to not fail on missing optional package
When `CMAKE_FIND_PACKAGE_PREFER_CONFIG` mode was set to `ON`, failure to find a package was fatal even if it was not `REQUIRED`. Fix this and add a test case. Fixes: #19557
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 1d4a8ed..171fa77 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -507,7 +507,9 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
loadedPackage = true;
} else {
// The package was not loaded. Report errors.
- HandlePackageMode(HandlePackageModeType::Module);
+ if (HandlePackageMode(HandlePackageModeType::Module)) {
+ loadedPackage = true;
+ }
}
}
} else {