# - set HAVE_XXX
# The minimum package list
-set(PACKAGELIST Git GLIB2 GMODULE2 GTHREAD2 GCRYPT LEX YACC Perl PythonInterp)
+set(PACKAGELIST Git GLIB2 GMODULE2 GTHREAD2 GCRYPT LEX YACC Perl)
set(LEX_OPTIONS REQUIRED)
set(GLIB2_OPTIONS REQUIRED)
set(GLIB2_FIND_OPTIONS REQUIRED)
set(GTHREAD2_OPTIONS REQUIRED)
set(GCRYPT_OPTIONS "1.4.2" REQUIRED)
set(Perl_OPTIONS REQUIRED)
-set(PythonInterp_OPTIONS "3.4" REQUIRED)
set(YACC_OPTIONS REQUIRED)
+if(CMAKE_VERSION VERSION_LESS "3.12")
+ # Locate the Python interpreter. Finds the wrong (Python 2) version if:
+ # - PATH contains python3.6, but not python3 (3.4). Affects RHEL7+EPEL.
+ # - Path contains C:\Python27 but not C:\Python37 (which is installed,
+ # but not present in PATH).
+ find_package(PythonInterp 3.4 REQUIRED)
+else()
+ find_package(Python3 3.4 REQUIRED)
+ # Several files (including LocatePythonModule) still use the old name
+ # from FindPythonInterp, let's stick to it for now.
+ set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
+endif()
+
if (NOT WIN32)
set(PACKAGELIST ${PACKAGELIST} Gettext M)
set(M_OPTIONS REQUIRED)
# After PATHS additional paths for python to search can be provided.
# When REQUIRED is set, the function will abort the cmake execution is the module is not found
function(LOCATE_PYTHON_MODULE module)
- find_package(PythonInterp)
+ if(NOT PYTHON_EXECUTABLE)
+ find_package(PythonInterp)
+ endif()
# Parse (additional) arguments
set(options REQUIRED)
optional libraries have xxx_INCLUDE_DIR and xxx_LIB flags that let you
control their discovery.
-
--DPYTHON_EXECUTABLE=c:/Python36/python:: Force the Python path.
-
-DENABLE_APPLICATION_BUNDLE=OFF:: Disable building an application bundle (Wireshark.app) on macOS
You can list all build variables (with help) by running `cmake -LH [options]