From 5db987f9224294e57e1916b6d15bdba0a80b1ab0 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 22 Apr 2021 06:53:13 +0200 Subject: [PATCH] cmake: use WEST_PYTHON as a preferred python installation if defined. Fixes: #34368 Now added WEST_PYTHON to list of preferred pythons to check. WEST_PYTHON is added after PYTHON_PREFER so that a user may still request a specific python is used by supplying `-DPYTHON_PREFER=` even when building using `west build`. Signed-off-by: Torsten Rasmussen --- cmake/python.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/python.cmake b/cmake/python.cmake index fd9f0c69b14..0ac40f9dc11 100644 --- a/cmake/python.cmake +++ b/cmake/python.cmake @@ -13,7 +13,7 @@ set(PYTHON_MINIMUM_REQUIRED 3.6) # We are using foreach here, instead of find_program(PYTHON_EXECUTABLE_SYSTEM_DEFAULT "python" "python3") # cause just using find_program directly could result in a python2.7 as python, and not finding a valid python3. -foreach(PYTHON_PREFER ${PYTHON_PREFER} "python" "python3") +foreach(PYTHON_PREFER ${PYTHON_PREFER} ${WEST_PYTHON} "python" "python3") find_program(PYTHON_PREFER_EXECUTABLE ${PYTHON_PREFER}) if(PYTHON_PREFER_EXECUTABLE) execute_process (COMMAND "${PYTHON_PREFER_EXECUTABLE}" -c