From 04e8d22478395b46e0dd339076433e325e863da1 Mon Sep 17 00:00:00 2001 From: brian gloyer Date: Sat, 1 Aug 2020 00:41:50 -0700 Subject: [PATCH 1/2] look for python in the form python38 Signed-off-by: brian gloyer --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95c9813..ae3b2d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,20 @@ cmake_minimum_required(VERSION 2.8.3) +project( + "boost-python-example" + LANGUAGES CXX +) + FIND_PACKAGE(PythonInterp) if (PYTHONINTERP_FOUND) if (UNIX AND NOT APPLE) if (PYTHON_VERSION_MAJOR EQUAL 3) FIND_PACKAGE(Boost COMPONENTS python${PYTHON_VERSION_SUFFIX}) + if (NOT Boost_FOUND) + # look for python in the form of python38 + FIND_PACKAGE(Boost COMPONENTS python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} REQUIRED) + endif() FIND_PACKAGE(PythonInterp 3) FIND_PACKAGE(PythonLibs 3 REQUIRED) else() From 50ec11f21af47a39585155fb7f535e6c20df8ed1 Mon Sep 17 00:00:00 2001 From: brian gloyer Date: Sat, 1 Aug 2020 23:38:34 -0700 Subject: [PATCH 2/2] additional search for python 2.x Signed-off-by: brian gloyer --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae3b2d1..1ff402c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,10 @@ if (PYTHONINTERP_FOUND) FIND_PACKAGE(PythonLibs 3 REQUIRED) else() FIND_PACKAGE(Boost COMPONENTS python) + if (NOT Boost_FOUND) + # look for python in the form of python27 + FIND_PACKAGE(Boost COMPONENTS python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} REQUIRED) + endif() FIND_PACKAGE(PythonInterp) FIND_PACKAGE(PythonLibs REQUIRED) endif()