findPython: Cannot find dev package if newer interpreter without dev package is installed
When searching for python development files, findPython locks the interpreter first and then checks the availability of the development files. I think it would be more helpful to walk the Python versions down until an interpreter with development files can be found.
Example on Fedora 38 with python3.10-3.10.14-2, python3.10-devel, and python3-3.11.8-2 installed
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Python (missing: Python_INCLUDE_DIRS Python_LIBRARIES Development Development.Module Development.Embed) (found suitable version "3.11.8", minimum required is "3") Call Stack (most recent call first): /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake/Modules/FindPython/Support.cmake:3824 (find_package_handle_standard_args) /usr/share/cmake/Modules/FindPython.cmake:574 (include) CMakeLists.txt:3 (find_package)
I think it would be more reasonable to select the python 3.10 interpreter in this case.