From a77a3dcb8b12fbec0ee6f98bce1f08578a9a90b2 Mon Sep 17 00:00:00 2001
From: xz-dev <xiangzhedev@gmail.com>
Date: Wed, 23 Oct 2024 20:00:38 +0800
Subject: [PATCH] cmake: fix python path with use multi-version python

---
 src/displayapp/fonts/CMakeLists.txt | 1 +
 src/resources/CMakeLists.txt        | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/displayapp/fonts/CMakeLists.txt b/src/displayapp/fonts/CMakeLists.txt
index 22627efc..562f0801 100644
--- a/src/displayapp/fonts/CMakeLists.txt
+++ b/src/displayapp/fonts/CMakeLists.txt
@@ -11,6 +11,7 @@ configure_file(${CMAKE_CURRENT_LIST_DIR}/jetbrains_mono_bold_20.c_M.patch
 if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
    # FindPython3 module introduces with CMake 3.12
    # https://cmake.org/cmake/help/latest/module/FindPython3.html
+   set(Python3_FIND_STRATEGY LOCATION) # https://discourse.cmake.org/t/find-package-python3-is-not-finding-the-correct-python/10563
    find_package(Python3 REQUIRED)
 else()
    set(Python3_EXECUTABLE "python")
diff --git a/src/resources/CMakeLists.txt b/src/resources/CMakeLists.txt
index 3834e854..9181d4a6 100644
--- a/src/resources/CMakeLists.txt
+++ b/src/resources/CMakeLists.txt
@@ -10,6 +10,7 @@ message(STATUS "Using ${LV_IMG_CONV} to generate font files")
 if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
    # FindPython3 module introduces with CMake 3.12
    # https://cmake.org/cmake/help/latest/module/FindPython3.html
+   set(Python3_FIND_STRATEGY LOCATION) # https://discourse.cmake.org/t/find-package-python3-is-not-finding-the-correct-python/10563
    find_package(Python3 REQUIRED)
 else()
    set(Python3_EXECUTABLE "python")