This is an archive of the discontinued LLVM Phabricator instance.

Cache PYTHON_EXECUTABLE for windows
ClosedPublic

Authored by hhb on Sep 16 2019, 4:39 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

hhb created this revision.Sep 16 2019, 4:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2019, 4:39 PM

Can we match what FindPythonInterp and FindPythonLibs does?

mark_as_advanced(
  PYTHON_EXECUTABLE
  PYTHON_DEBUG_LIBRARY
  PYTHON_LIBRARY
  PYTHON_INCLUDE_DIR
)
hhb updated this revision to Diff 220410.Sep 16 2019, 5:16 PM

Add mark_as_advanced.

hhb added a comment.Sep 16 2019, 5:18 PM

Can we match what FindPythonInterp and FindPythonLibs does?

mark_as_advanced(
  PYTHON_EXECUTABLE
  PYTHON_DEBUG_LIBRARY
  PYTHON_LIBRARY
  PYTHON_INCLUDE_DIR
)

Added for PYTHON_EXECUTABLE.

PYTHON_HOME is required, and other variables are derived from PYTHON_HOME. I don't think anyone will be interested in setting them separately...

In D67641#1671917, @hhb wrote:

Can we match what FindPythonInterp and FindPythonLibs does?

mark_as_advanced(
  PYTHON_EXECUTABLE
  PYTHON_DEBUG_LIBRARY
  PYTHON_LIBRARY
  PYTHON_INCLUDE_DIR
)

Added for PYTHON_EXECUTABLE.

PYTHON_HOME is required, and other variables are derived from PYTHON_HOME. I don't think anyone will be interested in setting them separately...

With mark_as_advanced you don't have to modify the code above. Even if they're not needed, I'd still prefer to include the other variables as well, just to maintain consistency with was CMake does.

hhb updated this revision to Diff 220424.Sep 16 2019, 7:28 PM

Fix comment.

This revision is now accepted and ready to land.Sep 17 2019, 9:23 AM
hhb updated this revision to Diff 220584.Sep 17 2019, 4:35 PM

Turns out I still need to change previous lines to remove PARENT_SCOPE. Otherwise local value will still be used even if a different value is set in the cache.

hhb updated this revision to Diff 220589.Sep 17 2019, 5:00 PM

Add CACHE PATH again. I think this is the only way to go.

With PARENT_SCOPE: Tthe local detected value is always used, even if a different value is set in cache.
With no parameter: Always the value in cache is used. If a value is not set in cache, empty is used.

JDevlieghere accepted this revision.Sep 17 2019, 5:40 PM

Hmm, that's unfortunately but I guess it makes sense. Let's remove the mark_as_advanced as it doesn't really serve a purpose anymore. Apologies about the churn!

hhb updated this revision to Diff 220594.Sep 17 2019, 5:58 PM

Fix comment

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 17 2019, 6:01 PM