From 6171c320dceed3e4ee8651db50d68633cd9dc48f Mon Sep 17 00:00:00 2001 From: TheMarpe Date: Wed, 15 Dec 2021 23:41:17 +0100 Subject: [PATCH] Reduced required CMake version (#498) --- scripts/find_python.cmake | 30 ++++++++++++++++++++---------- scripts/link-all.cmake | 2 +- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/scripts/find_python.cmake b/scripts/find_python.cmake index 554b551517..1811646011 100644 --- a/scripts/find_python.cmake +++ b/scripts/find_python.cmake @@ -1,14 +1,24 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.0) -if(DEFINED ENV{HUNTER_PYTHON_LOCATION}) - set(Python_ROOT_DIR $ENV{HUNTER_PYTHON_LOCATION}) - set(Python_FIND_STRATEGY LOCATION) -endif() +if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + find_package(PythonInterp 3 QUIET) + if(NOT PYTHONINTERP_FOUND) + message(FATAL_ERROR "Python not found") + endif() + message(${PYTHON_EXECUTABLE}) +else() + cmake_minimum_required(VERSION 3.12) -find_package(Python COMPONENTS Interpreter QUIET) + if(DEFINED ENV{HUNTER_PYTHON_LOCATION}) + set(Python_ROOT_DIR $ENV{HUNTER_PYTHON_LOCATION}) + set(Python_FIND_STRATEGY LOCATION) + endif() -if(NOT Python_Interpreter_FOUND) - message(FATAL_ERROR "Python not found") -endif() + find_package(Python COMPONENTS Interpreter QUIET) -message(${Python_EXECUTABLE}) + if(NOT Python_Interpreter_FOUND) + message(FATAL_ERROR "Python not found") + endif() + + message(${Python_EXECUTABLE}) +endif() \ No newline at end of file diff --git a/scripts/link-all.cmake b/scripts/link-all.cmake index e3f8215a45..049a0a3b4f 100644 --- a/scripts/link-all.cmake +++ b/scripts/link-all.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.0) string(COMPARE EQUAL "${HUNTER_INSTALL_PREFIX}" "" is_empty) if(is_empty)