Skip to content
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

Cmake python #105

Merged
merged 3 commits into from
Mar 2, 2024
Merged

Cmake python #105

merged 3 commits into from
Mar 2, 2024

Conversation

jfpanisset
Copy link
Contributor

CMake 3.12 adds FindPython which replaces FindPythonInterp and FindPythonLibs and updates corresponding result variables. As of CMake 3.27 you must set CMP0148 to OLD to retain this behavior. This PR updates CMake code to the new behavior while retaining support for older CMake versions.

CMake 3.12 adds FindPython which replaces FindPythonInterp
and FindPythonLibs and updates corresponding result variables.
As of CMake 3.27 you must set CMP0148 to OLD to retain this behavior.
This PR updates CMake code to the new behavior while retaining
support for older CMake versions.

Signed-off-by: Jean-Francois Panisset <panisset@gmail.com>
Signed-off-by: Jean-Francois Panisset <panisset@gmail.com>
CMakeLists.txt Outdated
else()
find_package(PythonInterp REQUIRED)
find_package(PythonLibs REQUIRED)
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making this backwards-compatible. I just noticed that we're already using cmake_minimum_required(VERSION 3.15.0) so we already specify a minimum cmake version of 3.15.

That suggests that we can drop the backwards compatibility. Please adjust these changes so that they only support the newer FindPython module.

There is one small tweak we'll need above ~ please use find_package(Python REQUIRED COMPONENTS ...) so that cmake will error-out during the configure step when python is not available. It's currently missing the REQUIRED option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes pushed to branch as requested, thank you for the review.

For context, I'm converting the build of partio to a Conan package for the aswf-docker project, which is when I ran into complaints from recent CMake version about pre-FindPython usage.

As per review, partio specifies CMake 3.15 or newer so
backwards compatibility is not required.
Also build should fail if FindPython doesn't find Python.

Signed-off-by: Jean-Francois Panisset <panisset@gmail.com>
@davvid davvid merged commit c044c3b into wdas:main Mar 2, 2024
@davvid
Copy link
Member

davvid commented Mar 2, 2024

Thanks! I made some tiny tweaks on top of this, but it's all good now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants