[Lldb-commits] [PATCH] D65230: [CMake] Loosen Python version check and ignore patch version
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 24 15:02:08 PDT 2019
JDevlieghere updated this revision to Diff 211606.
JDevlieghere added a comment.
Use lowercase variables for locals.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65230/new/
https://reviews.llvm.org/D65230
Files:
lldb/cmake/modules/LLDBConfig.cmake
Index: lldb/cmake/modules/LLDBConfig.cmake
===================================================================
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -199,9 +199,23 @@
find_package(PythonLibs REQUIRED)
endif()
- if (NOT PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING AND
- NOT CMAKE_CROSSCOMPILING)
- message(FATAL_ERROR "Found incompatible Python interpreter (${PYTHON_VERSION_STRING}) and Python libraries (${PYTHONLIBS_VERSION_STRING})")
+ if (NOT CMAKE_CROSSCOMPILING)
+ # Manually split PYTHON_VERSION_STRING because find_python_libs_windows
+ # doesn't set PYTHON_VERSION_MAJOR or PYTHON_VERSION_MINOR.
+ string(REPLACE "." ";" python_version_list ${PYTHON_VERSION_STRING})
+ string(REPLACE "." ";" pythonlibs_version_list ${PYTHONLIBS_VERSION_STRING})
+ list(GET python_version_list 0 python_major)
+ list(GET python_version_list 1 python_minor)
+ list(GET pythonlibs_version_list 0 pythonlibs_major)
+ list(GET pythonlibs_version_list 1 pythonlibs_minor)
+
+ # Ignore the patch version. Some versions of macOS report a different patch
+ # version for the system provided interpreter and libraries.
+ if (NOT python_major VERSION_EQUAL pythonlibs_major OR
+ NOT python_minor VERSION_EQUAL pythonlibs_minor)
+ message(FATAL_ERROR "Found incompatible Python interpreter (${python_major}.${python_minor})"
+ " and Python libraries (${pythonlibs_major}.${pythonlibs_minor})")
+ endif()
endif()
if (PYTHON_INCLUDE_DIR)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65230.211606.patch
Type: text/x-patch
Size: 1581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190724/91477420/attachment-0001.bin>
More information about the lldb-commits
mailing list