[PATCH] D78762: build: use `find_package(Python3)` if available

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 18:53:04 PDT 2020


compnerd added a comment.

I was trying to do the minimal change to cover llvm.  I definitely care about LLD and will do that in a subsequent change.

As to the benefit of this, it is primarily that the detection here explicitly ensures that python3 is used rather than python2.  The fallback of aliasing is the easiest way to achieve this without having a lot of complicated logic at each site:

  if(NOT Python3_Interpreter_FOUND)
    add_custom_command(...)
  else()
    add_custom_command(...)
  endif()

which would be the way to handle that.  Creating another wrapper function is a terrible thing just to filter out incidental python usage would not only be extremely complicated but a large amount of logic that would also increase configure times unnecessarily.

The detection here is far more robust and precise.  `Python3_EXECUTABLE` is the CMake variable name, not something that I chose.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78762/new/

https://reviews.llvm.org/D78762





More information about the llvm-commits mailing list