honor Python2_EXECUTABLE and Python3_EXECUTABLE when they are passed to cmake
authorRobert Underwood <rr.underwood94@gmail.com>
Tue, 17 Nov 2020 23:44:00 +0000 (17:44 -0600)
committerMichael Kruse <llvm-project@meinersbur.de>
Tue, 17 Nov 2020 23:49:14 +0000 (17:49 -0600)
commit16de50895e96adbe261a5ce2498366bda7b3fccd
tree7b068dc647484e252dca862cfdf6ac645415537f
parentbb8f2585c6eab263916757435d71df16d92de4a8
honor Python2_EXECUTABLE and Python3_EXECUTABLE when they are passed to cmake

CMake's find_package(Python3) and find_package(Python2) packages have a PYTHON_EXECUTABLE, Python2_EXECUTABLE, and Python3_EXECUTABLE cmake variables which control which version of python is built against.  As far as I can tell, the rest of LLVM honors these variables. This can cause the build process to fail when  if the automatically selected version of Python can't run due to modifications of LD_LIBRARY_PATH when using spack.  The corresponding Spack issue is https://github.com/spack/spack/issues/19908.  The corresponding LLVM issue is 48180

I believe an appropriate fix is to add the variables to the list of PASSTHROUGH_VARIABLES in cmake/Modules/AddCompilerRT.cmake, and this fixed compilation errors for me.

This bug affects distributions like Gentoo and package managers like Spack which allow for combinatorial versioning.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D91536
compiler-rt/cmake/Modules/AddCompilerRT.cmake