[PATCH] cmake: Use FindPython instead of deprecated |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- Subject: [PATCH] cmake: Use FindPython instead of deprecated
- From: Thomas Staudinger <Staudi.Kaos@xxxxxxxxx>
- Date: Sun, 16 Jun 2024 00:04:32 +0200
Bumps required cmake version to 3.12
Signed-off-by: Thomas Staudinger <Staudi.Kaos@xxxxxxxxx>
---
CMakeLists.txt | 20 +++++++-------------
tools/CMakeLists.txt | 6 +++---
2 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 737bcc49..7a9b9abb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,4 @@
-cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
-
-if(POLICY CMP0148)
- # Should be removed when we replaced FindPythonInterp with FindPython3
- # and cmake_minimum_required has been bumped to 3.12
- cmake_policy(SET CMP0148 OLD)
-endif(POLICY CMP0148)
+cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
# Set build type to "Release" if user did not specify any build type yet
# Other possible values: Debug, Release, RelWithDebInfo and MinSizeRel
@@ -372,14 +366,14 @@ if(NOT CMAKE_CROSSCOMPILING)
add_subdirectory(tests)
endif(NOT CMAKE_CROSSCOMPILING)
-include(FindPythonInterp)
-if(PYTHONINTERP_FOUND AND PYTHON_VERSION_MAJOR LESS 3)
+include(FindPython)
+if(Python_Interpreter_FOUND AND Python_VERSION_MAJOR LESS 3)
message("Note: Hatari needs at least Python 3 ... ignoring older version")
- unset(PYTHONINTERP_FOUND)
+ unset(Python_Interpreter_FOUND)
endif()
set(PYTHON_GTK_FOUND 0)
-if(PYTHONINTERP_FOUND)
- execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "\
+if(Python_Interpreter_FOUND)
+ execute_process(COMMAND ${Python_EXECUTABLE} -c "\
import gi\n\
gi.require_version('Gtk', '3.0')\n\
from gi.repository import Gtk\n\
@@ -392,7 +386,7 @@ from gi.repository import GLib"
set(PYTHON_GTK_FOUND 1)
add_subdirectory(python-ui)
endif()
-endif(PYTHONINTERP_FOUND)
+endif(Python_Interpreter_FOUND)
if(UNIX AND NOT ENABLE_OSX_BUNDLE)
add_subdirectory(share)
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index be342912..3856cab1 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -1,11 +1,11 @@
add_subdirectory(hmsa)
-include(FindPythonInterp)
-if(PYTHONINTERP_FOUND)
+include(FindPython)
+if(Python_Interpreter_FOUND)
add_subdirectory(hconsole)
add_subdirectory(debugger)
-endif(PYTHONINTERP_FOUND)
+endif(Python_Interpreter_FOUND)
install(PROGRAMS atari-convert-dir.py DESTINATION ${BINDIR} RENAME
atari-convert-dir)
install(PROGRAMS hatari-prg-args.sh DESTINATION ${BINDIR} RENAME
hatari-prg-args)
--
2.45.1
--00000000000096c989061af552e4
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Hello,</div><div><br></div><div>attached is a small p=
atch to use FindPython instead of the deprecated FindPythonInterp. The latt=
er also leads to build issues on e.g. Solus. This bumps the required cmake =
version to 3.12, which was released in July 2018, so almost 6 years ago.<br=
><br></div><div>BR,</div><div>Thomas<br></div><div><br><br>From 2ee10c3e4f6=
a192492a387ed0d5d6091c2f493b4 Mon Sep 17 00:00:00 2001<br>From: Thomas Stau=
dinger <<a href=3D"mailto:Staudi.Kaos@xxxxxxxxx">Staudi.Kaos@xxxxxxxxx</=
a>><br>Date: Sun, 16 Jun 2024 00:04:32 +0200<br>Subject: [PATCH] cmake: =
Use FindPython instead of deprecated FindPythonInterp<br><br>Bumps required=
cmake version to 3.12<br><br>Signed-off-by: Thomas Staudinger <<a href=
=3D"mailto:Staudi.Kaos@xxxxxxxxx">Staudi.Kaos@xxxxxxxxx</a>><br>---<br>=
=C2=A0CMakeLists.txt =C2=A0 =C2=A0 =C2=A0 | 20 +++++++-------------<br>=C2=
=A0tools/CMakeLists.txt | =C2=A06 +++---<br>=C2=A02 files changed, 10 inser=
tions(+), 16 deletions(-)<br><br>diff --git a/CMakeLists.txt b/CMakeLists.t=
xt<br>index 737bcc49..7a9b9abb 100644<br>--- a/CMakeLists.txt<br>+++ b/CMak=
eLists.txt<br>@@ -1,10 +1,4 @@<br>-cmake_minimum_required(VERSION 3.5 FATAL=
_ERROR)<br>-<br>-if(POLICY CMP0148)<br>- # Should be removed when we replac=
ed FindPythonInterp with FindPython3<br>- # and cmake_minimum_required has =
been bumped to 3.12<br>- cmake_policy(SET CMP0148 OLD)<br>-endif(POLICY CMP=
0148)<br>+cmake_minimum_required(VERSION 3.12 FATAL_ERROR)<br>=C2=A0<br>=C2=
=A0# Set build type to "Release" if user did not specify any buil=
d type yet<br>=C2=A0# Other possible values: Debug, Release, RelWithDebInfo=
and MinSizeRel<br>@@ -372,14 +366,14 @@ if(NOT CMAKE_CROSSCOMPILING)<br>=
=C2=A0 add_subdirectory(tests)<br>=C2=A0endif(NOT CMAKE_CROSSCOMPILING)<br>=
=C2=A0<br>-include(FindPythonInterp)<br>-if(PYTHONINTERP_FOUND AND PYTHON_V=
ERSION_MAJOR LESS 3)<br>+include(FindPython)<br>+if(Python_Interpreter_FOUN=
D AND Python_VERSION_MAJOR LESS 3)<br>=C2=A0 message("Note: Hatari nee=
ds at least Python 3 ... ignoring older version")<br>- unset(PYTHONINT=
ERP_FOUND)<br>+ unset(Python_Interpreter_FOUND)<br>=C2=A0endif()<br>=C2=A0s=
et(PYTHON_GTK_FOUND 0)<br>-if(PYTHONINTERP_FOUND)<br>- execute_process(COMM=
AND ${PYTHON_EXECUTABLE} -c "\<br>+if(Python_Interpreter_FOUND)<br>+ e=
xecute_process(COMMAND ${Python_EXECUTABLE} -c "\<br>=C2=A0import gi\n=
\<br>=C2=A0gi.require_version('Gtk', '3.0')\n\<br>=C2=A0fro=
m gi.repository import Gtk\n\<br>@@ -392,7 +386,7 @@ from gi.repository imp=
ort GLib"<br>=C2=A0 set(PYTHON_GTK_FOUND 1)<br>=C2=A0 add_subdirecto=
ry(python-ui)<br>=C2=A0 endif()<br>-endif(PYTHONINTERP_FOUND)<br>+endif(Pyt=
hon_Interpreter_FOUND)<br>=C2=A0<br>=C2=A0if(UNIX AND NOT ENABLE_OSX_BUNDLE=
)<br>=C2=A0 add_subdirectory(share)<br>diff --git a/tools/CMakeLists.txt b/=
tools/CMakeLists.txt<br>index be342912..3856cab1 100644<br>--- a/tools/CMak=
eLists.txt<br>+++ b/tools/CMakeLists.txt<br>@@ -1,11 +1,11 @@<br>=C2=A0<br>=
=C2=A0add_subdirectory(hmsa)<br>=C2=A0<br>-include(FindPythonInterp)<br>-if=
(PYTHONINTERP_FOUND)<br>+include(FindPython)<br>+if(Python_Interpreter_FOUN=
D)<br>=C2=A0 add_subdirectory(hconsole)<br>=C2=A0 add_subdirectory(debugger=
)<br>-endif(PYTHONINTERP_FOUND)<br>+endif(Python_Interpreter_FOUND)<br>=C2=
=A0<br>=C2=A0install(PROGRAMS atari-convert-dir.py DESTINATION ${BINDIR} RE=
NAME atari-convert-dir)<br>=C2=A0install(PROGRAMS hatari-prg-args.sh DESTIN=
ATION ${BINDIR} RENAME hatari-prg-args)<br>-- <br>2.45.1</div></div>
--00000000000096c989061af552e4--