diff --git a/CMakeLists.txt b/CMakeLists.txt index 730cdd9..6f9e552 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ -# Copyright: (C) 2022 Fondazione Istituto Italiano di Tecnologia +# Copyright: (C) Fondazione Istituto Italiano di Tecnologia # Authors: Silvio Traversaro # CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.8...3.16) project(icub-models VERSION 2.3.0) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index dbe0273..2fd933a 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -15,8 +15,13 @@ if(ICUB_MODELS_USES_PYTHON) if(ICUB_MODELS_DETECT_ACTIVE_PYTHON_SITEPACKAGES) set(ICUB_MODELS_PYTHON_INSTALL_DIR ${Python3_SITELIB}) else() - execute_process(COMMAND ${Python3_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,prefix=''))" - OUTPUT_VARIABLE _PYTHON_INSTDIR) + if(Python3_VERSION VERSION_GREATER_EQUAL 3.12) + execute_process(COMMAND ${Python3_EXECUTABLE} -c "import os;import sysconfig;relative_site_packages = sysconfig.get_path('purelib').replace(sysconfig.get_path('data'), '').lstrip(os.path.sep);print(relative_site_packages)" + OUTPUT_VARIABLE _PYTHON_INSTDIR) + else() + execute_process(COMMAND ${Python3_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,prefix=''))" + OUTPUT_VARIABLE _PYTHON_INSTDIR) + endif() string(STRIP ${_PYTHON_INSTDIR} _PYTHON_INSTDIR_CLEAN) set(ICUB_MODELS_PYTHON_INSTALL_DIR ${_PYTHON_INSTDIR_CLEAN}) endif()