File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ string(REGEX REPLACE "\\\\" "/" PYTHON_PREFIX "${PYTHON_PREFIX}")
147147string (REGEX REPLACE "\\\\ " "/" PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR} " )
148148string (REGEX REPLACE "\\\\ " "/" PYTHON_SITE_PACKAGES "${PYTHON_SITE_PACKAGES} " )
149149
150- if (CMAKE_HOST_WIN32 AND NOT (MINGW AND DEFINED ENV{MSYSTEM}) )
150+ if (CMAKE_HOST_WIN32 )
151151 set (PYTHON_LIBRARY
152152 "${PYTHON_PREFIX} /libs/python${PYTHON_LIBRARY_SUFFIX} .lib" )
153153
@@ -159,6 +159,20 @@ if(CMAKE_HOST_WIN32 AND NOT (MINGW AND DEFINED ENV{MSYSTEM}))
159159 "${_PYTHON_ROOT} /libs/python${PYTHON_LIBRARY_SUFFIX} .lib" )
160160 endif ()
161161
162+ # if we are in MSYS & MINGW, and we didn't find windows python lib, look for system python lib
163+ if (DEFINED ENV{MSYSTEM} AND MINGW AND NOT EXISTS "${PYTHON_LIBRARY} " )
164+ if (PYTHON_MULTIARCH)
165+ set (_PYTHON_LIBS_SEARCH "${PYTHON_LIBDIR} /${PYTHON_MULTIARCH} " "${PYTHON_LIBDIR} " )
166+ else ()
167+ set (_PYTHON_LIBS_SEARCH "${PYTHON_LIBDIR} " )
168+ endif ()
169+ unset (PYTHON_LIBRARY)
170+ find_library (PYTHON_LIBRARY
171+ NAMES "python${PYTHON_LIBRARY_SUFFIX} "
172+ PATHS ${_PYTHON_LIBS_SEARCH}
173+ NO_DEFAULT_PATH)
174+ endif ()
175+
162176 # raise an error if the python libs are still not found.
163177 if (NOT EXISTS "${PYTHON_LIBRARY} " )
164178 message (FATAL_ERROR "Python libraries not found" )
You can’t perform that action at this time.
0 commit comments