JDevlieghere created this revision. JDevlieghere added reviewers: shafik, arphaman, sgraenitz, davide. JDevlieghere added a project: LLDB. Herald added subscribers: dexonsmith, mgorny.
Some versions of macOS report a different patch version for the system provided interpreter and libraries. Repository: rLLDB LLDB 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,24 @@ 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. Use the LLDB + # prefix to not shadow the actual variables. + string(REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHON_VERSION_STRING}) + string(REPLACE "." ";" PYTHONLIBS_VERSION_LIST ${PYTHONLIBS_VERSION_STRING}) + list(GET PYTHON_VERSION_LIST 0 LLDB_PYTHON_MAJOR) + list(GET PYTHON_VERSION_LIST 1 LLDB_PYTHON_MINOR) + list(GET PYTHONLIBS_VERSION_LIST 0 LLDB_PYTHONLIBS_MAJOR) + list(GET PYTHONLIBS_VERSION_LIST 1 LLDB_PYTHONLIBS_MINOR) + + # Ignore the patch version. Some versions of macOS report a different patch + # version for the system provided interpreter and libraries. + if (NOT LLDB_PYTHON_MAJOR VERSION_EQUAL LLDB_PYTHONLIBS_MAJOR OR + NOT LLDB_PYTHON_MINOR VERSION_EQUAL LLDB_PYTHONLIBS_MINOR) + message(FATAL_ERROR "Found incompatible Python interpreter (${LLDB_PYTHON_MAJOR}.${LLDB_PYTHON_MINOR})" + " and Python libraries (${LLDB_PYTHONLIBS_MAJOR}.${LLDB_PYTHONLIBS_MINOR})") + endif() endif() if (PYTHON_INCLUDE_DIR)
Index: lldb/cmake/modules/LLDBConfig.cmake =================================================================== --- lldb/cmake/modules/LLDBConfig.cmake +++ lldb/cmake/modules/LLDBConfig.cmake @@ -199,9 +199,24 @@ 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. Use the LLDB + # prefix to not shadow the actual variables. + string(REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHON_VERSION_STRING}) + string(REPLACE "." ";" PYTHONLIBS_VERSION_LIST ${PYTHONLIBS_VERSION_STRING}) + list(GET PYTHON_VERSION_LIST 0 LLDB_PYTHON_MAJOR) + list(GET PYTHON_VERSION_LIST 1 LLDB_PYTHON_MINOR) + list(GET PYTHONLIBS_VERSION_LIST 0 LLDB_PYTHONLIBS_MAJOR) + list(GET PYTHONLIBS_VERSION_LIST 1 LLDB_PYTHONLIBS_MINOR) + + # Ignore the patch version. Some versions of macOS report a different patch + # version for the system provided interpreter and libraries. + if (NOT LLDB_PYTHON_MAJOR VERSION_EQUAL LLDB_PYTHONLIBS_MAJOR OR + NOT LLDB_PYTHON_MINOR VERSION_EQUAL LLDB_PYTHONLIBS_MINOR) + message(FATAL_ERROR "Found incompatible Python interpreter (${LLDB_PYTHON_MAJOR}.${LLDB_PYTHON_MINOR})" + " and Python libraries (${LLDB_PYTHONLIBS_MAJOR}.${LLDB_PYTHONLIBS_MINOR})") + endif() endif() if (PYTHON_INCLUDE_DIR)
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits