CMAKE_FIND_PACKAGE_PREFER_CONFIG can cause infinite recursion
consider the following cmake buildsystem
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
find_package(Broken)
with cmake/FindBroken.cmake as
find_package(Broken NO_MODULE)
With CMAKE_FIND_PACKAGE_PREFER_CONFIG=OFF
this will successfully configure. With CMAKE_FIND_PACKAGE_PREFER_CONFIG=ON
it will infinitely recuse on the fine_package call in FindBroken.cmake, because although we explicitly call find_package(NO_MODULE)
cmake still includes the module, presumably after trying the config version.
This would seem to be a critical bug both because of the recursion and because find_package(NO_MODULE)
is, in fact, finding module packages.
Note that this makes FindBoost.cmake (and probably many other included find modules) not work in CMAKE_FIND_PACKAGE_PREFER_CONFIG
mode
reproduced (and encountered on) 3.15-rc4