summaryrefslogtreecommitdiff
blob: c0dc3804c83c8d34def380549a63c7f404df5dc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From c794fb5f0f616ce2d9e4004fc459a1c50f077470 Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Sun, 11 Oct 2020 22:47:55 +0200
Subject: [PATCH] Use CMake FindPython3 module, raises minimum CMake to 3.12

Gives us out-of-the-box future proof python detection (python-3.9 right now).
---
 CMakeLists.txt                     |  2 +-
 src/backends/CMakeLists.txt        | 10 ++++------
 src/backends/python/CMakeLists.txt |  4 +---
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e96e6df0..a90328b5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
+cmake_minimum_required (VERSION 3.12 FATAL_ERROR)
 
 set(CMAKE_CXX_STANDARD 11)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
diff --git a/src/backends/CMakeLists.txt b/src/backends/CMakeLists.txt
index e99e1731..9b6b615e 100644
--- a/src/backends/CMakeLists.txt
+++ b/src/backends/CMakeLists.txt
@@ -50,15 +50,13 @@ if(QALCULATE_FOUND)
     add_subdirectory(qalculate)
 endif(QALCULATE_FOUND)
 
-set_package_properties(PythonLibs3 PROPERTIES DESCRIPTION "A powerful dynamic programming language."
-    URL "https://www.python.org/"
-    TYPE OPTIONAL
+set_package_properties(Python3 PROPERTIES TYPE OPTIONAL
     PURPOSE "Backend to use Python with Cantor.")
 
-find_package(PythonLibs3)
-if(PYTHONLIBS3_FOUND)
+find_package(Python3 COMPONENTS Interpreter Development)
+if(Python3_FOUND)
     add_subdirectory(python)
-endif(PYTHONLIBS3_FOUND)
+endif()
 
 set_package_properties(LuaJIT PROPERTIES DESCRIPTION "A lightweight, extensible programming language (luajit implementation)."
     URL "https://www.lua.org/"
diff --git a/src/backends/python/CMakeLists.txt b/src/backends/python/CMakeLists.txt
index 04b4c313..c7868561 100644
--- a/src/backends/python/CMakeLists.txt
+++ b/src/backends/python/CMakeLists.txt
@@ -14,8 +14,6 @@ set(PythonServer_SRCS
   pythonserver.cpp
 )
 
-include_directories(${PYTHONLIBS3_INCLUDE_DIRS})
-
 qt5_add_resources(PythonBackend_RSCS python.qrc)
 ki18n_wrap_ui(PythonBackend_SRCS settings.ui)
 kconfig_add_kcfg_files(PythonBackend_SRCS settings.kcfgc)
@@ -34,7 +32,7 @@ set_target_properties(cantor_pythonserver PROPERTIES INSTALL_RPATH_USE_LINK_PATH
 if(MSVC)
   set_property(TARGET cantor_pythonserver PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE")
 endif()
-target_link_libraries(cantor_pythonserver ${PYTHONLIBS3_LIBRARIES})
+target_link_libraries(cantor_pythonserver Python3::Python)
 
 if(BUILD_TESTING)
   add_executable(testpython testpython.cpp settings.cpp)
-- 
2.28.0