Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enforces the use of find_package(Python) by removing conditional checks that would skip Python finding when Python was already found. The change ensures that Python detection logic runs unconditionally rather than being bypassed when Python variables are already set.
- Removes the outer conditional wrapper around Python finding logic
- Ensures Python detection always executes regardless of existing Python_FOUND or Python3_FOUND variables
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if(NOT DEFINED Python_FIND_IMPLEMENTATIONS) | ||
| set(Python_FIND_IMPLEMENTATIONS CPython PyPy) | ||
| endif() |
There was a problem hiding this comment.
With the removal of the outer conditional check, this Python configuration will now run unconditionally. Consider whether this could overwrite existing Python_FIND_IMPLEMENTATIONS settings or if additional guards are needed to prevent reconfiguration when Python is already properly configured.
|
We don't want to call FindPython if it's already been called with the right components present. Or if the user is using the old PythonInterp/Libs support. So I think the check can't be removed, but should instead check for everything that is needed, and trigger the find if everything isn't there. |
What's the problem in doing so? Do you fear performance issues? As far a I know, cmake's find functions cache previous results. So that shouldn't be a big deal.
I think this is not relevant here, as the old mode is handled in
This would require moving the logic to figure out the required components out of the |
FindPython is the exception (see Python_ARTIFACTS_INTERACTIVE, 3.18+). It was trying to do some weird things, like finding multiple different versions of Python in one build, so it's a really weird find module. |
Fixes #5813