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

[WIP] migrate cmake to use FindPython instead of FindPythonInterp+FindPythonLibs #7393

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

rvianello
Copy link
Contributor

What does this implement/fix? Explain your changes.

With cmake version 3.27.7 the following warning is produced at configuration time:

[cmake] CMake Warning (dev) at CMakeLists.txt:302 (find_package):
[cmake]   Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
[cmake]   are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
[cmake]   the cmake_policy command to set the policy and suppress this warning.

cmake --help-policy CMP0148 produces the following output:

CMP0148
-------

.. versionadded:: 3.27

The ``FindPythonInterp`` and ``FindPythonLibs`` modules are removed.

These modules have been deprecated since CMake 3.12.
CMake 3.27 and above prefer to not provide the modules.
This policy provides compatibility for projects that have not been
ported away from them.

Projects using the ``FindPythonInterp`` and/or ``FindPythonLibs``
modules should be updated to use one of their replacements:

* ``FindPython3``
* ``FindPython2``
* ``FindPython``

The ``OLD`` behavior of this policy is for ``find_package(PythonInterp)``
and ``find_package(PythonLibs)`` to load the deprecated modules.  The ``NEW``
behavior is for uses of the modules to fail as if they do not exist.

This policy was introduced in CMake version 3.27.  CMake version
3.27.7 warns when the policy is not set and uses ``OLD`` behavior.
Use the ``cmake_policy()`` command to set it to ``OLD`` or ``NEW``
explicitly.

.. note::
  The ``OLD`` behavior of a policy is
  ``deprecated by definition``
  and may be removed in a future version of CMake.

This PR migrates the RDKit cmake files to use FindPython.

Any other comments?

The changes are for the most part relatively simple, the part I'm less confident in is the replacement of PYTHON_ADD_MODULE with Python_add_library in Code/cmake/Modules/RDKitUtils.cmake, that I was at the moment only able to test on Linux.

@greglandrum
Copy link
Member

@rvianello this is still marked WIP. Is it ready for review?

@rvianello
Copy link
Contributor Author

@greglandrum the changes to the cmake scripts should be mostly complete, but configuration fails for the windows and macos CI builds. I'll try investigating/troubleshooting these issues first.

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.

None yet

2 participants