summaryrefslogtreecommitdiffstats
path: root/Modules/FindPython/Support.cmake
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2022-06-05 12:41:18 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2022-06-05 12:44:04 (GMT)
commit8de50bae84aadbff8251b768ce108ed6b27e62d0 (patch)
tree06c117da40576ce2f49106fcf2a10b2e0f2fde1b /Modules/FindPython/Support.cmake
parent2a56c240391c59a0d78dbf90911f38a79f161f7d (diff)
downloadCMake-8de50bae84aadbff8251b768ce108ed6b27e62d0.zip
CMake-8de50bae84aadbff8251b768ce108ed6b27e62d0.tar.gz
CMake-8de50bae84aadbff8251b768ce108ed6b27e62d0.tar.bz2
FindPython*: enhance interpreter lookup
Fixes: #23588
Diffstat (limited to 'Modules/FindPython/Support.cmake')
-rw-r--r--Modules/FindPython/Support.cmake13
1 files changed, 11 insertions, 2 deletions
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index cbb6c1c..8e98500 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -1248,9 +1248,18 @@ endif()
# Python and Anaconda distributions: define which architectures can be used
if (CMAKE_SIZEOF_VOID_P)
- # In this case, search only for 64bit or 32bit
math (EXPR _${_PYTHON_PREFIX}_ARCH "${CMAKE_SIZEOF_VOID_P} * 8")
- set (_${_PYTHON_PREFIX}_ARCH2 ${_${_PYTHON_PREFIX}_ARCH})
+ if ("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
+ OR "Development.Embed" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
+ # In this case, search only for 64bit or 32bit
+ set (_${_PYTHON_PREFIX}_ARCH2 ${_${_PYTHON_PREFIX}_ARCH})
+ else()
+ if (_${_PYTHON_PREFIX}_ARCH EQUAL "32")
+ set (_${_PYTHON_PREFIX}_ARCH2 64)
+ else()
+ set (_${_PYTHON_PREFIX}_ARCH2 32)
+ endif()
+ endif()
else()
# architecture unknown, search for both 64bit and 32bit
set (_${_PYTHON_PREFIX}_ARCH 64)