diff options
-rw-r--r-- | CMakeLists.txt | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b63a562..4fc2e0ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ set(Required_CMake_Version 3.16.2) set(Required_Boost_Version 1.72) +set(Required_Python_Version 3.9) cmake_minimum_required(VERSION ${Required_CMake_Version}) @@ -65,16 +66,12 @@ if (USE_PYTHON) message(ERROR "Building the python module requires BUILD_LIBRARY=ON.") endif() - find_package(Python COMPONENTS Interpreter Development) - if (PYTHON_FOUND) - if (${Python_VERSION_MAJOR} VERSION_GREATER_EQUAL "3") - set(BOOST_PYTHON "python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}") - set(HAVE_BOOST_PYTHON 1) - include_directories(SYSTEM ${Python_INCLUDE_DIRS}) - else() - set(HAVE_BOOST_PYTHON 0) - message("Ledger requires Python >= 3.x") - endif() + find_package(Python + COMPONENTS Interpreter Development) + if (PYTHON_FOUND AND ${Python_VERSION} VERSION_LESS ${Required_Python_Version}) + set(BOOST_PYTHON "python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}") + set(HAVE_BOOST_PYTHON 1) + include_directories(SYSTEM ${Python_INCLUDE_DIRS}) else() set(HAVE_BOOST_PYTHON 0) message("Could not find a Python library to use with Boost.Python") |