diff options
author | Brad King <brad.king@kitware.com> | 2019-08-07 13:57:22 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-08-07 13:57:35 (GMT) |
commit | ce14f6c67724fccc25547db62e645ab8d115841c (patch) | |
tree | 85ab70a5fc02d6cdfe6f7f471e8d11492702395c | |
parent | e295290ed707a78a0ba6c66cbd1bbf069b5d582c (diff) | |
parent | 8ed868606ddae005b4a50319bdc291b8df5b525a (diff) | |
download | CMake-ce14f6c67724fccc25547db62e645ab8d115841c.zip CMake-ce14f6c67724fccc25547db62e645ab8d115841c.tar.gz CMake-ce14f6c67724fccc25547db62e645ab8d115841c.tar.bz2 |
Merge topic 'find_package-prefer-config-not-found'
8ed868606d find_package: Fix prefer-config mode to not fail on missing optional package
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3653
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 4 | ||||
-rw-r--r-- | Tests/FindPackageTest/CMakeLists.txt | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 04fbbad..0159ca5 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -517,7 +517,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 { diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 519608c..7217f43 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -653,3 +653,9 @@ find_package(ACME NO_MODULE) if(ACME_FOUND) message(SEND_ERROR "Should not find ACME package") endif() + +############################################################################ +##Test find_package CMAKE_FIND_PACKAGE_PREFER_CONFIG with unknown package + +set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON) +find_package(DoesNotExist) |