From 7928160c9a1e6252506b0869c1f00f0a09769d5f Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Wed, 29 Jul 2026 22:21:25 +0000 Subject: [PATCH 9/9] Build the pywatchman C extension with the configured compiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01K6JXw8CwYRiXvqHMBGZRgP --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b507c82..2cde575 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -447,6 +447,12 @@ if(Python3_Development_FOUND) COMMAND ${CMAKE_COMMAND} -E env CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} + # Build the C extension with the same compiler as the rest of + # the build. Without this, distutils uses the CC recorded in the Python + # installation's sysconfig data, which may not even exist on this + # machine. + CC=${CMAKE_C_COMPILER} + CXX=${CMAKE_CXX_COMPILER} ${Python3_EXECUTABLE} ${SETUP_PY} build --build-base ${PYOUT} COMMAND ${CMAKE_COMMAND} -E touch ${PYOUT} ) @@ -455,6 +461,8 @@ if(Python3_Development_FOUND) execute_process(COMMAND ${CMAKE_COMMAND} -E env CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} + CC=${CMAKE_C_COMPILER} + CXX=${CMAKE_CXX_COMPILER} ${Python3_EXECUTABLE} ${SETUP_PY} install --root $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${PYWATCHMAN_BASE}