FIx cmake warning on CMP0148

- find_package(PythonInterp) and find_package(PythonLibs) were deprecated in 3.12 and removed in 3.27
- The project minimum is at 3.16 already
diff --git a/build/cmake/DefineOptions.cmake b/build/cmake/DefineOptions.cmake
index b938d7c..3584b5f 100644
--- a/build/cmake/DefineOptions.cmake
+++ b/build/cmake/DefineOptions.cmake
@@ -117,10 +117,13 @@
 
 # Python
 option(WITH_PYTHON "Build Python Thrift library" ON)
-find_package(PythonInterp QUIET) # for Python executable
-find_package(PythonLibs QUIET) # for Python.h
+find_package(Python3
+    COMPONENTS
+        Interpreter # for Python executable
+        Development # for Python.h
+    QUIET)
 CMAKE_DEPENDENT_OPTION(BUILD_PYTHON "Build Python library" ON
-                       "BUILD_LIBRARIES;WITH_PYTHON;PYTHONINTERP_FOUND;PYTHONLIBS_FOUND" OFF)
+                       "BUILD_LIBRARIES;WITH_PYTHON;Python3_Interpreter_FOUND;Python3_Development_FOUND" OFF)
 
 # Common library options
 # https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html
@@ -206,7 +209,7 @@
 message(STATUS)
 message(STATUS "  Build Python library:                       ${BUILD_PYTHON}")
 MESSAGE_DEP(WITH_PYTHON "Disabled by WITH_PYTHON=OFF")
-MESSAGE_DEP(PYTHONLIBS_FOUND "Python libraries missing")
+MESSAGE_DEP(Python3_Development_FOUND "Python libraries missing")
 if(MSVC)
     message(STATUS "  Using static runtime library:               ${WITH_MT}")
 endif(MSVC)
diff --git a/compiler/cpp/test/CMakeLists.txt b/compiler/cpp/test/CMakeLists.txt
index 6cf309b..e042257 100644
--- a/compiler/cpp/test/CMakeLists.txt
+++ b/compiler/cpp/test/CMakeLists.txt
@@ -30,8 +30,8 @@
     endforeach()
 endforeach()
 
-find_package(PythonInterp QUIET)
-if(PYTHONINTERP_FOUND)
+find_package(Python3 COMPONENTS Interpreter QUIET)
+if(Python3_Interpreter_FOUND)
   add_test(NAME StalenessCheckTest COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/compiler/staleness_check.py ${THRIFT_COMPILER})
 else()
   message(WARNING "Skipping StalenessCheckTest as there is no python interpreter available.")