File: 0018-Migrate-away-from-PythonInterp-CMake-module.patch

package info (click to toggle)
ros-catkin 0.8.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,212 kB
  • sloc: python: 4,117; sh: 508; xml: 256; cpp: 136; makefile: 125
file content (38 lines) | stat: -rw-r--r-- 1,283 bytes parent folder | download
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
From: Mike Purvis <mpurvis@clearpathrobotics.com>
Date: Wed, 10 Apr 2024 13:57:08 -0400
Subject: [PATCH] Migrate away from PythonInterp CMake module

---
 CMakeLists.txt     | 2 +-
 cmake/python.cmake | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a22596b..7908ca7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0.2)
+cmake_minimum_required(VERSION 3.12.0)
 
 set(catkin_EXTRAS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
 
diff --git a/cmake/python.cmake b/cmake/python.cmake
index 406da0b..5e45ad4 100644
--- a/cmake/python.cmake
+++ b/cmake/python.cmake
@@ -4,7 +4,13 @@ set(PYTHON_VERSION "$ENV{ROS_PYTHON_VERSION}" CACHE STRING "Specify specific Pyt
 if(NOT PYTHON_VERSION)
   set(PYTHON_VERSION 3)
 endif()
-find_package(PythonInterp ${PYTHON_VERSION} REQUIRED)
+find_package(Python ${PYTHON_VERSION} REQUIRED)
+
+# Set these legacy variables for compatibility with what PythonInterp used to do
+set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
+set(PYTHON_VERSION_MAJOR ${Python_VERSION_MAJOR})
+set(PYTHON_VERSION_MINOR ${Python_VERSION_MINOR})
+set(PYTHON_VERSION_PATCH ${Python_VERSION_PATCH})
 
 message(STATUS "Using PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}")