cmake: Moved back to requiring merely CMake 3.0.0.

This means it now works with any CMake released since 2014 instead of 2018.

This was mostly just readding some special cases, and requiring 3.11.0 only
for Windows Stores apps, which isn't unreasonable. The biggest concern is
a Linux distribution not having a recent CMake; most other places will be
manually downloading and installing their own CMake.

Fixes #4930.
This commit is contained in:
Ryan C. Gordon 2021-11-09 11:06:33 -05:00
parent cfdbd6acca
commit 3a82e432f0
No known key found for this signature in database
GPG key ID: FA148B892AB48044

View file

@ -2,7 +2,7 @@ if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the SDL source code and run \"cmake -S ${CMAKE_SOURCE_DIR} -B .\" from there")
endif()
cmake_minimum_required(VERSION 3.11.0)
cmake_minimum_required(VERSION 3.0.0)
project(SDL2 C CXX)
if (HAIKU)
@ -18,6 +18,7 @@ endif()
add_library(sdl-build-options INTERFACE)
if(WINDOWS_STORE)
cmake_minimum_required(VERSION 3.11.0)
target_compile_definitions(sdl-build-options INTERFACE "-DSDL_BUILDING_WINRT=1")
target_compile_options(sdl-build-options INTERFACE "-ZW")
endif()
@ -225,6 +226,14 @@ if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA)
set(OPT_DEF_LIBC ON)
endif()
if(NOT ("$ENV{CFLAGS}" STREQUAL ""))
if(CMAKE_VERSION VERSION_LESS 3.11.0)
message(WARNING "SDL's CMakeLists.txt no longer checks the CFLAGS environment.")
message(WARNING "Please use CMake's CMAKE_C_FLAGS and CMAKE_BUILD_TYPE variables directly.")
message(WARNING "Or upgrade to CMake >= 3.11.0, which respects the CFLAGS environment var.")
endif()
endif()
if(MSVC)
option(SDL_FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
if(SDL_FORCE_STATIC_VCRT)