[Lldb-commits] [lldb] r366243 - [CMake] Fail when Python interpreter doesn't match Python libraries version
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 16 11:27:12 PDT 2019
Author: jdevlieghere
Date: Tue Jul 16 11:27:12 2019
New Revision: 366243
URL: http://llvm.org/viewvc/llvm-project?rev=366243&view=rev
Log:
[CMake] Fail when Python interpreter doesn't match Python libraries version
Because of how CMake finds the Python libraries and interpreter, it's
possible to end up with a discrepancy between the two. For example,
you'd end up using a Python 3 interpreter to run the test suite while
LLDB was built and linked against Python 2.
This patch adds a fatal error to CMake so we find out at configuration
time, instead of finding out at test time.
Differential revision: https://reviews.llvm.org/D64812
Modified:
lldb/trunk/cmake/modules/LLDBConfig.cmake
Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=366243&r1=366242&r2=366243&view=diff
==============================================================================
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Tue Jul 16 11:27:12 2019
@@ -185,7 +185,6 @@ function(find_python_libs_windows)
endfunction(find_python_libs_windows)
if (NOT LLDB_DISABLE_PYTHON)
-
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
find_python_libs_windows()
@@ -194,8 +193,12 @@ if (NOT LLDB_DISABLE_PYTHON)
add_definitions( -DLLDB_PYTHON_HOME="${LLDB_PYTHON_HOME}" )
endif()
else()
- find_package(PythonInterp)
- find_package(PythonLibs)
+ find_package(PythonInterp REQUIRED)
+ find_package(PythonLibs REQUIRED)
+ endif()
+
+ if (NOT PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING)
+ message(FATAL_ERROR "Found incompatible Python interpreter (${PYTHON_VERSION_STRING}) and Python libraries (${PYTHONLIBS_VERSION_STRING})")
endif()
if (PYTHON_INCLUDE_DIR)
More information about the lldb-commits
mailing list