mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-14 19:01:55 +00:00
Fixes: #23922, #24252, #11103 This commit switches to use the find_package(Python3) introduced with CMake 3.12. This removes the need for a Zephyr backport of Python detection module. The search order for Python3 is following CMake search order and can be controlled through CMake flags (See CMake documentation). Default it will use the Python version found in PATH. If multiple Python3 versions are found in PATH, the newest version will be selected (Can be controlled using `Python3_FIND_STRATEGY`) Using find_package(Python3) also ensures Python2.7 will never be selected, issue #11103, which was re-introduced in Zephyr. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
14 lines
475 B
CMake
14 lines
475 B
CMake
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# On Windows, instruct Python to output UTF-8 even when not
|
|
# interacting with a terminal. This is required since Python scripts
|
|
# are invoked by CMake code and, on Windows, standard I/O encoding defaults
|
|
# to the current code page if not connected to a terminal, which is often
|
|
# not what we want.
|
|
if (WIN32)
|
|
set(ENV{PYTHONIOENCODING} "utf-8")
|
|
endif()
|
|
|
|
find_package(Python3 3.6 REQUIRED)
|
|
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
|