From 3a82e432f0344ad3a4a619615fd3bd4c3455a9e0 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 9 Nov 2021 11:06:33 -0500 Subject: [PATCH] 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. --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbb282959..06721edc1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)