Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
python detection with pythoninterp was deprecated in cmake 3.12. And breaks in 3.19
[simgrid.git] / CMakeLists.txt
index 1af66cb..06992c3 100644 (file)
@@ -137,12 +137,19 @@ if(NOT PERL_FOUND)
 endif()
 
 # tesh.py needs python 3 (or the module python-subprocess32 on python2.8+)
 endif()
 
 # tesh.py needs python 3 (or the module python-subprocess32 on python2.8+)
-set(PythonInterp_FIND_VERSION 3)
-set(PythonInterp_FIND_VERSION_COUNT 1)
-set(PythonInterp_FIND_VERSION_MAJOR 3)
-include(FindPythonInterp)
-if(NOT PYTHONINTERP_FOUND)
-  message(FATAL_ERROR "Please install Python (version 3 or higher) to compile SimGrid.")
+if(CMAKE_VERSION VERSION_LESS "3.12")
+  set(PythonInterp_FIND_VERSION 3)
+  set(PythonInterp_FIND_VERSION_COUNT 1)
+  set(PythonInterp_FIND_VERSION_MAJOR 3)
+  include(FindPythonInterp)
+  if(NOT PYTHONINTERP_FOUND)
+    message(FATAL_ERROR "Please install Python (version 3 or higher) to compile SimGrid.")
+  endif()
+else()
+  find_package(Python3)
+  if(NOT Python3_FOUND)
+    message(FATAL_ERROR "Please install Python (version 3 or higher) to compile SimGrid.")
+  endif()
 endif()
 
 SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
 endif()
 
 SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
@@ -800,7 +807,7 @@ if((NOT DEFINED enable_python) OR enable_python)
     set(pybind11_FOUND ON)
 
     set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_HOME_DIRECTORY}/pybind11/tools/)
     set(pybind11_FOUND ON)
 
     set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_HOME_DIRECTORY}/pybind11/tools/)
-    set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4)
+    set(Python_ADDITIONAL_VERSIONS 3.9 3.8 3.7 3.6 3.5 3.4)
     find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED)
 
   else()
     find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED)
 
   else()