--- CMakeLists.txt.orig	2025-08-30 03:55:56 UTC
+++ CMakeLists.txt
@@ -172,14 +172,14 @@ if (SURELOG_WITH_PYTHON)
 
 # Python
 if (SURELOG_WITH_PYTHON)
-  find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
+  find_package(Python3 ${FREEBSD_PYTHON_DISTVERSION} EXACT REQUIRED COMPONENTS Interpreter Development)
   find_package(SWIG REQUIRED)
   message(STATUS "Python3_LIBRARIES = ${Python3_LIBRARIES}")
   message(STATUS "Python3_EXECUTABLE = ${Python3_EXECUTABLE}")
   message(STATUS "Python3_INCLUDE_DIRS = ${Python3_INCLUDE_DIRS}")
   message(STATUS "Python3_RUNTIME_LIBRARY_DIRS = ${Python3_RUNTIME_LIBRARY_DIRS}")
 else()
-  find_package(Python3 3.3 REQUIRED Interpreter)
+  find_package(Python3 ${FREEBSD_PYTHON_DISTVERSION} EXACT REQUIRED Interpreter)
   message(STATUS "Python3_EXECUTABLE = ${Python3_EXECUTABLE}")
 endif()
 
@@ -278,7 +278,7 @@ add_custom_command(
 )
 
 # Java
-find_package(Java 11 REQUIRED COMPONENTS Runtime)
+find_package(Java ${FREEBSD_JAVA_VERSION} REQUIRED COMPONENTS Runtime)
 message(STATUS "Java_JAVA_EXECUTABLE = ${Java_JAVA_EXECUTABLE}")
 
 set(surelog_grammars
