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)
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)
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)
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()