This is an archive of the discontinued LLVM Phabricator instance.

[Cmake] Unify python variables
ClosedPublic

Authored by JDevlieghere on Mar 28 2019, 4:32 PM.

Details

Summary

Both FindPythonInterp and FindPythonLibs do two things, they'll set some variables (PYTHON_LIBRARIES, PYTHON_INCLUDE_DIRS) and update the cached variables (PYTHON_LIBRARY, PYTHON_INCLUDE_DIR) that are also used to specify a custom python installation.

I believe the canonical way to do this is to use the PYTHON_LIBRARIES and PYTHON_INCLUDE_DIRS variables instead of the cached ones. However, since the cached variables are accessible from the cache and GUI, this is a lot less confusing when you're trying to debug why a variable did or didn't get the value you expected. Furthermore, as far as I can tell, the implementation uses the cached variables to set their LIBRARIES/DIRS counterparts. This is also the reason this works today even though we mix-and-match.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

JDevlieghere created this revision.Mar 28 2019, 4:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2019, 4:32 PM
This revision is now accepted and ready to land.Mar 28 2019, 4:38 PM
labath added inline comments.Mar 28 2019, 11:41 PM
lldb/cmake/modules/LLDBConfig.cmake
246–247 ↗(On Diff #192735)

Is there any difference between include(FindPythonInterp) and find_package(PythonInterp)? It sounds like the latter should be used, because it's more specific, but I have no idea its possible to do that..

This revision was automatically updated to reflect the committed changes.