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

Fix CMake Warning FindPythonInterp and FindPythonLibs modules are removed #486

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

rickyjames35
Copy link
Contributor

When running cmake configure on this project I get:

CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
are removed. Run "cmake --help-policy CMP0148" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.

This is caused by usage of deprecated functionality find_package(PythonInterp 3) in the root CMakeLists.txt.

Relevant CMake documentation: https://cmake.org/cmake/help/latest/policy/CMP0148.html

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.

Here's the new way of finding Python: https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3

@CLAassistant
Copy link

CLAassistant commented Jul 14, 2024

CLA assistant check
All committers have signed the CLA.

@rickyjames35 rickyjames35 changed the title Fix CMake Warning: Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules are removed Fix CMake Warning FindPythonInterp and FindPythonLibs modules are removed Jul 14, 2024
@rickyjames35 rickyjames35 marked this pull request as draft July 14, 2024 02:08
@rickyjames35
Copy link
Contributor Author

Seems that src/CMakeLists.txt has a couple places where the PYTHONPATH is being passed in. I was hoping this would be an easy fix but it might not be. @rpavlik do you have any thoughts?

"${CMAKE_COMMAND}" -E env "PYTHONPATH=${CODEGEN_PYTHON_PATH}"

@maksim-petukhov
Copy link

maksim-petukhov commented Jul 17, 2024

When using Python3 cmake module, Python3_EXECUTABLE should be used instead of PYTHON_EXECUTABLE in /CMakeLists.txt, /src/CMakeLists.txt and /include/openxr/CMakeLists.txt. And there is no problem with PYTHONPATH.

@rickyjames35
Copy link
Contributor Author

Thanks @maksim-petukhov, your suggestion worked.

@rickyjames35 rickyjames35 marked this pull request as ready for review July 21, 2024 17:07
@rpavlik-bot rpavlik-bot added the synced to gitlab Synchronized to OpenXR internal GitLab label Jul 23, 2024
@rpavlik-bot
Copy link
Collaborator

An issue (number 2326) has been filed to correspond to this pull request in the internal Khronos GitLab (Khronos members only: KHR:openxr/openxr#2326 ), to facilitate working group processes.

This GitHub pull request will continue to be the main site of discussion.

@rpavlik
Copy link
Contributor

rpavlik commented Aug 29, 2024

Will this work as far back as CMake 3.16?

edit: ah, the deprecation started in 3.12, so apparently it is fine, oops. We were holding the line at 3.10 for a long time.

@rpavlik rpavlik force-pushed the 1-cmp0148-warning branch 3 times, most recently from 1d4be37 to b3d23b8 Compare August 29, 2024 19:08
Copy link
Contributor

@rpavlik rpavlik left a comment

Choose a reason for hiding this comment

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

Thanks for this! I have squashed your commits, adjusted the commit message, added a changelog fragment, and fixed the CMake formatting (apparently the CMake format config file is not shipped in this repo?)

@rpavlik rpavlik enabled auto-merge (rebase) August 29, 2024 19:09
The old style used was deprecated in CMake 3.12, so this should
not negatively impact our compatibility (requires 3.16)

rpavlik: Only need interpreter, add changelog fragment
@rpavlik rpavlik merged commit 545f7bf into KhronosGroup:main Aug 29, 2024
30 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
synced to gitlab Synchronized to OpenXR internal GitLab
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants