-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update deprecated FindPython #4782
Conversation
CMake 2.27 removes support for deprecated FindPython scripts. In case CMake is custom built/installed in /usr/local, it seems to pick up the version of FindPython from the /usr/share folder. This causes issues when, for example, using a custom built installation of Python in `/usr/local`: if the version is more recent than what's listed in the system CMake script, it's not picked up. Use the new version of the script, so Python is picked up correctly.
CMake 3.5 on Ubuntu 20 seems to be missing All other failures are missing |
FindPython was added in 3.15, and we still have to support 3.10 or so. There are several options already implemented:
Anything else would not be backward compatible and would break a lot of code. For the bug you are seeing, there might need to be a fix, but we can't break thousands of existing packages doing it. :) |
@@ -16,6 +16,9 @@ else() | |||
cmake_policy(VERSION 3.26) | |||
endif() | |||
|
|||
# Include Python headers from FindPython | |||
include_directories(${Python_INCLUDE_DIRS}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should happen via targets already. You shouldn't need to use targetless commands like this in modern CMake.
If you find a way to fix (or reproduce via docker) the |
I see. I encountered this bug while working at my previous company, but I don't have access to that repository anymore so unfortunately I'm unable to reproduce. Thanks for the review! |
CMake 2.27 removes support for deprecated FindPython scripts.
In case CMake is custom built/installed in /usr/local, it seems to pick up the version of FindPython from the /usr/share folder. This causes issues when, for example, using a custom built installation of Python in
/usr/local
: if the version is more recent than what's listed in the system CMake script, it's not picked up.Use the new version of the script, so Python is picked up correctly.
Description
Suggested changelog entry: