From 93deae84f323c9f93bac048a7234e5f89e253205 Mon Sep 17 00:00:00 2001 From: Mike Purvis 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 a22596b1b..7908ca776 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 c72b85999..140c90913a19 100644 --- a/cmake/python.cmake +++ b/cmake/python.cmake @@ -1,7 +1,13 @@ # the CMake variable PYTHON_INSTALL_DIR has the same value as the Python function catkin.builder.get_python_install_dir() set(PYTHON_VERSION "$ENV{ROS_PYTHON_VERSION}" CACHE STRING "Specify specific Python version to use ('major.minor' or 'major')") -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}")