|
|
@@ -607,14 +607,24 @@ function (_PYTHON_GET_VERSION)
|
|
|
# ABI not used on Windows
|
|
|
set (abi "")
|
|
|
else()
|
|
|
- if (config MATCHES "#[ ]*define[ ]+Py_DEBUG[ ]+1")
|
|
|
- string (APPEND abi "d")
|
|
|
- endif()
|
|
|
- if (config MATCHES "#[ ]*define[ ]+WITH_PYMALLOC[ ]+1")
|
|
|
- string (APPEND abi "m")
|
|
|
- endif()
|
|
|
- if (config MATCHES "#[ ]*define[ ]+Py_UNICODE_SIZE[ ]+4")
|
|
|
- string (APPEND abi "u")
|
|
|
+ if (NOT config)
|
|
|
+ # pyconfig.h can be a wrapper to a platform specific pyconfig.h
|
|
|
+ # In this case, try to identify ABI from include directory
|
|
|
+ if (_${_PYTHON_PREFIX}_INCLUDE_DIR MATCHES "python${version_major}\.${version_minor}+([dmu]*)")
|
|
|
+ set (abi "${CMAKE_MATCH_1}")
|
|
|
+ else()
|
|
|
+ set (abi "")
|
|
|
+ endif()
|
|
|
+ else()
|
|
|
+ if (config MATCHES "#[ ]*define[ ]+Py_DEBUG[ ]+1")
|
|
|
+ string (APPEND abi "d")
|
|
|
+ endif()
|
|
|
+ if (config MATCHES "#[ ]*define[ ]+WITH_PYMALLOC[ ]+1")
|
|
|
+ string (APPEND abi "m")
|
|
|
+ endif()
|
|
|
+ if (config MATCHES "#[ ]*define[ ]+Py_UNICODE_SIZE[ ]+4")
|
|
|
+ string (APPEND abi "u")
|
|
|
+ endif()
|
|
|
endif()
|
|
|
set (${_PGV_PREFIX}ABI "${abi}" PARENT_SCOPE)
|
|
|
endif()
|