diff --git a/CMakeLists.txt b/CMakeLists.txt
index ce5d64715f..80ac6bc9df 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -587,7 +587,7 @@ if(UNIX)
endif()
if(ENABLE_SDL)
- dolphin_find_optional_system_library(SDL2 Externals/SDL 2.26.0)
+ dolphin_find_optional_system_library(SDL2 Externals/SDL 2.30.6)
endif()
if(ENABLE_ANALYTICS)
diff --git a/Externals/SDL/CMakeLists.txt b/Externals/SDL/CMakeLists.txt
index 599caff4d4..c30d8ae979 100644
--- a/Externals/SDL/CMakeLists.txt
+++ b/Externals/SDL/CMakeLists.txt
@@ -1,13 +1,30 @@
option(SDL2_DISABLE_SDL2MAIN "" ON)
option(SDL2_DISABLE_INSTALL "" ON)
option(SDL2_DISABLE_UNINSTALL "" ON)
-set(SDL_SHARED OFF)
-set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
-set(SDL_STATIC ON)
-set(SDL_STATIC_ENABLED_BY_DEFAULT ON)
-set(SDL_TEST OFF)
-set(SDL_TEST_ENABLED_BY_DEFAULT OFF)
-set(OPT_DEF_LIBC ON)
+option(SDL_SHARED "Build a shared version of the library" OFF)
+option(SDL_SHARED_ENABLED_BY_DEFAULT "" OFF)
+option(SDL_STATIC "Build a static version of the library" ON)
+option(SDL_STATIC_ENABLED_BY_DEFAULT "" ON)
+option(SDL_TEST "Build the SDL2_test library" OFF)
+option(SDL_TEST_ENABLED_BY_DEFAULT "" OFF)
+
+# SDL fails to clean up old headers after version upgrades, so do that manually
+set(EXPECTED_SDL_REVISION "SDL-release-2.30.6-0")
+if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/SDL/include/SDL2/SDL_revision.h")
+ file(READ "${CMAKE_CURRENT_BINARY_DIR}/SDL/include/SDL2/SDL_revision.h" ACTUAL_SDL_REVISION)
+ if (NOT "${ACTUAL_SDL_REVISION}" MATCHES "${EXPECTED_SDL_REVISION}")
+ message(STATUS "Found unexpected SDL2/SDL_revision.h, removing generated includes.")
+ file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/SDL/include/")
+ endif()
+endif()
+if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/SDL/include/SDL_revision.h")
+ file(READ "${CMAKE_CURRENT_BINARY_DIR}/SDL/include/SDL_revision.h" ACTUAL_SDL_REVISION)
+ if (NOT "${ACTUAL_SDL_REVISION}" MATCHES "${EXPECTED_SDL_REVISION}")
+ message(STATUS "Found unexpected SDL_revision.h, removing generated includes.")
+ file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/SDL/include/")
+ endif()
+endif()
+
add_subdirectory(SDL)
if (TARGET SDL2)
dolphin_disable_warnings(SDL2)
diff --git a/Externals/SDL/SDL b/Externals/SDL/SDL
index ac13ca9ab6..ba2f78a006 160000
--- a/Externals/SDL/SDL
+++ b/Externals/SDL/SDL
@@ -1 +1 @@
-Subproject commit ac13ca9ab691e13e8eebe9684740ddcb0d716203
+Subproject commit ba2f78a0069118a6c583f1fbf1420144ffa35bad
diff --git a/Externals/SDL/SDL2.vcxproj b/Externals/SDL/SDL2.vcxproj
index 1693429f70..66aace96fc 100644
--- a/Externals/SDL/SDL2.vcxproj
+++ b/Externals/SDL/SDL2.vcxproj
@@ -130,11 +130,17 @@
+
+
+
+
+
+
@@ -185,6 +191,13 @@
+
+
+
+
+
+
+
@@ -198,6 +211,7 @@
+
@@ -230,14 +244,19 @@
-
-
-
+
+
+
+
+
+
+
+
@@ -290,14 +309,17 @@
+
+
+
@@ -400,7 +422,9 @@
-
+
+
+