My current patch is changing the line to if ((\_${\_PYTHON_PREFIX}*ARCHITECTURE_ID MATCHES "ARM") OR (*${\_PYTHON_PREFIX}\_ARCHITECTURE_ID MATCHES "aarch"))
Ok. I think I understood the problem. As specified by the documentation of CMAKE_LANG_COMPILER_ARCHITECTURE_ID variable, the value depends on the ABI (GNU or MSVC).