From 75c8fb12e48058966fff59795d0d11020604ca41 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 15 Jan 2020 15:03:18 +0100 Subject: [PATCH] cmake: add custom error messsage about Python 3 This should be helpful as developers need to migrate to Python 3. --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a9fba14e6..cd2df2db54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,7 +267,13 @@ endif() # If using catkin, Python 2 is found since it points # to the Python libs installed with the ROS distro if (NOT CATKIN_DEVEL_PREFIX) - find_package(PythonInterp 3 REQUIRED) + find_package(PythonInterp 3) + # We have a custom error message to tell users how to install python3. + if (NOT PYTHONINTERP_FOUND) + message(FATAL_ERROR "Python 3 not found. Please install Python 3:\n" + " Ubuntu: sudo apt install python3 python3-devel python3-pip\n" + " macOS: brew install python") + endif() else() find_package(PythonInterp REQUIRED) endif()