@@ -82,11 +82,12 @@ print(s.get_config_var('SO'));
8282print(hasattr(sys, 'gettotalrefcount')+0);
8383print(struct.calcsize('@P'));
8484print(s.get_config_var('LDVERSION') or s.get_config_var('VERSION'));
85+ print(s.get_config_var('LIBDIR') or '');
86+ print(s.get_config_var('MULTIARCH') or '');
8587"
8688 RESULT_VARIABLE _PYTHON_SUCCESS
8789 OUTPUT_VARIABLE _PYTHON_VALUES
88- ERROR_VARIABLE _PYTHON_ERROR_VALUE
89- OUTPUT_STRIP_TRAILING_WHITESPACE)
90+ ERROR_VARIABLE _PYTHON_ERROR_VALUE)
9091
9192if (NOT _PYTHON_SUCCESS MATCHES 0)
9293 if (PythonLibsNew_FIND_REQUIRED)
@@ -108,6 +109,8 @@ list(GET _PYTHON_VALUES 4 PYTHON_MODULE_EXTENSION)
108109list (GET _PYTHON_VALUES 5 PYTHON_IS_DEBUG)
109110list (GET _PYTHON_VALUES 6 PYTHON_SIZEOF_VOID_P)
110111list (GET _PYTHON_VALUES 7 PYTHON_LIBRARY_SUFFIX)
112+ list (GET _PYTHON_VALUES 8 PYTHON_LIBDIR)
113+ list (GET _PYTHON_VALUES 9 PYTHON_MULTIARCH)
111114
112115# Make sure the Python has the same pointer-size as the chosen compiler
113116# Skip if CMAKE_SIZEOF_VOID_P is not defined
@@ -137,28 +140,25 @@ string(REGEX REPLACE "\\\\" "/" PYTHON_SITE_PACKAGES ${PYTHON_SITE_PACKAGES})
137140if (CMAKE_HOST_WIN32 )
138141 set (PYTHON_LIBRARY
139142 "${PYTHON_PREFIX} /libs/Python${PYTHON_LIBRARY_SUFFIX} .lib" )
140-
141- # when run in a venv, PYTHON_PREFIX points to it. But the libraries remain in the
143+
144+ # when run in a venv, PYTHON_PREFIX points to it. But the libraries remain in the
142145 # original python installation. They may be found relative to PYTHON_INCLUDE_DIR.
143146 if (NOT EXISTS "${PYTHON_LIBRARY} " )
144147 get_filename_component (_PYTHON_ROOT ${PYTHON_INCLUDE_DIR} DIRECTORY )
145148 set (PYTHON_LIBRARY
146149 "${_PYTHON_ROOT} /libs/Python${PYTHON_LIBRARY_SUFFIX} .lib" )
147150 endif ()
148-
151+
149152 # raise an error if the python libs are still not found.
150153 if (NOT EXISTS "${PYTHON_LIBRARY} " )
151154 message (FATAL_ERROR "Python libraries not found" )
152155 endif ()
153-
154- elseif (APPLE )
155- set (PYTHON_LIBRARY
156- "${PYTHON_PREFIX} /lib/libpython${PYTHON_LIBRARY_SUFFIX} .dylib" )
156+
157157else ()
158- if (${PYTHON_SIZEOF_VOID_P} MATCHES 8 )
159- set (_PYTHON_LIBS_SEARCH "${PYTHON_PREFIX} /lib64 " "${PYTHON_PREFIX} /lib " )
158+ if (PYTHON_MULTIARCH )
159+ set (_PYTHON_LIBS_SEARCH "${PYTHON_LIBDIR} / ${PYTHON_MULTIARCH} " "${PYTHON_LIBDIR} " )
160160 else ()
161- set (_PYTHON_LIBS_SEARCH "${PYTHON_PREFIX} /lib " )
161+ set (_PYTHON_LIBS_SEARCH "${PYTHON_LIBDIR} " )
162162 endif ()
163163 #message(STATUS "Searching for Python libs in ${_PYTHON_LIBS_SEARCH}")
164164 # Probably this needs to be more involved. It would be nice if the config
0 commit comments