Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Bump cmake to at least 3.12
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 3 Mar 2023 22:57:15 +0000 (23:57 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 3 Mar 2023 22:58:39 +0000 (23:58 +0100)
- It's difficult to search for Python Development component before that version
- This version is available in Debian buster (oldstable)

CMakeLists.txt
examples/sthread/CMakeLists.txt
tools/cmake/Flags.cmake

index 1d9bb8b..f702831 100644 (file)
@@ -21,12 +21,8 @@ set(SIMGRID_VERSION_STRING "SimGrid version ${release_version}")
 set(libsimgrid_version "${release_version}")
 
 # Basic checks on cmake
-cmake_minimum_required(VERSION 3.5)
-#for lto, to avoid warning (should be removed when switching to requiring cmake >= 3.9)
-if(NOT CMAKE_VERSION VERSION_LESS "3.9")
-  cmake_policy(SET CMP0069 NEW)
-endif()
-# once we move >= 3.13, we should use target_link_option in examples/sthread
+cmake_minimum_required(VERSION 3.12)
+# once we move CMake to >= 3.13, we should use target_link_option in examples/sthread
 message(STATUS "Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_HOME_DIRECTORY}/tools/cmake/Modules)
 
@@ -132,21 +128,11 @@ if(NOT PERL_FOUND)
 endif()
 
 # tesh.py needs python 3 (or the module python-subprocess32 on python2.8+)
-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 COMPONENTS Interpreter)
-  if(NOT Python3_Interpreter_FOUND)
-    message(FATAL_ERROR "Please install Python (version 3 or higher) to compile SimGrid.")
-  endif()
-  set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
+find_package(Python3 COMPONENTS Interpreter)
+if(NOT Python3_Interpreter_FOUND)
+  message(FATAL_ERROR "Please install Python (version 3 or higher) to compile SimGrid.")
 endif()
+set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
 
 SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
 
index d53f419..2f6f99f 100644 (file)
@@ -40,7 +40,7 @@ foreach(x
     add_executable       (pthread-${x} EXCLUDE_FROM_ALL pthread-${x}.c)
     set_target_properties(pthread-${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
     target_link_libraries(pthread-${x} PRIVATE Threads::Threads)
-    target_link_libraries(pthread-${x} PUBLIC "-Wl,-znorelro -Wl,-znoseparate-code") # TODO: convert to target_link_option once cmake is >3.13
+    target_link_libraries(pthread-${x} PUBLIC "-Wl,-znorelro -Wl,-znoseparate-code") # TODO: convert to target_link_option once CMAKE_VERSION is >3.13
 
     add_dependencies(tests-mc pthread-${x})
     ADD_TESH_FACTORIES(pthread-mc-${x} "^thread" --setenv libdir=${CMAKE_BINARY_DIR}/lib --cd ${CMAKE_BINARY_DIR}/examples/sthread ${CMAKE_CURRENT_SOURCE_DIR}/pthread-mc-${x}.tesh)
index f90b2b4..60aeeca 100644 (file)
@@ -122,18 +122,10 @@ if(enable_lto) # User wants LTO. Try if we can do that
   set(enable_lto OFF)
   if(enable_compile_optimizations
       AND (NOT enable_model-checking))
-    if(CMAKE_VERSION VERSION_LESS "3.9")
-      if ( CMAKE_COMPILER_IS_GNUCC
-         AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.8.5")
-         AND (LINKER_VERSION VERSION_GREATER "2.22"))
-        set(enable_lto ON)
-      endif()
-    else()
-      include(CheckIPOSupported)
-      check_ipo_supported(RESULT ipo LANGUAGES C CXX)
-      if(ipo)
-        set(enable_lto ON)
-      endif()
+    include(CheckIPOSupported)
+    check_ipo_supported(RESULT ipo LANGUAGES C CXX)
+    if(ipo)
+      set(enable_lto ON)
     endif()
   endif()