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)