Skip to content

Commit a97c4d2

Browse files
authored
fix(cmake): support Windows ARM cross-compilation (pybind#4406)
Signed-off-by: Henry Schreiner <[email protected]> Signed-off-by: Henry Schreiner <[email protected]>
1 parent 09db644 commit a97c4d2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tools/FindPythonLibsNew.cmake

+4-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ string(REGEX REPLACE "\\\\" "/" PYTHON_PREFIX "${PYTHON_PREFIX}")
208208
string(REGEX REPLACE "\\\\" "/" PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
209209
string(REGEX REPLACE "\\\\" "/" PYTHON_SITE_PACKAGES "${PYTHON_SITE_PACKAGES}")
210210

211-
if(CMAKE_HOST_WIN32)
211+
if(DEFINED PYTHON_LIBRARY)
212+
# Don't write to PYTHON_LIBRARY if it's already set
213+
elseif(CMAKE_HOST_WIN32)
212214
set(PYTHON_LIBRARY "${PYTHON_PREFIX}/libs/python${PYTHON_LIBRARY_SUFFIX}.lib")
213215

214216
# when run in a venv, PYTHON_PREFIX points to it. But the libraries remain in the
@@ -274,7 +276,7 @@ if(NOT PYTHON_DEBUG_LIBRARY)
274276
endif()
275277
set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
276278

277-
find_package_message(PYTHON "Found PythonLibs: ${PYTHON_LIBRARY}"
279+
find_package_message(PYTHON "Found PythonLibs: ${PYTHON_LIBRARIES}"
278280
"${PYTHON_EXECUTABLE}${PYTHON_VERSION_STRING}")
279281

280282
set(PYTHONLIBS_FOUND TRUE)

0 commit comments

Comments
 (0)