From 6209661c76ce2d345ed891d7353f4d38615c0ce4 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Fri, 26 Apr 2019 03:42:57 +0100 Subject: [PATCH] Fixed SDL2 exporting DLL symbols in static builds --- external/SDL2/CMakeLists.txt | 1 + external/SDL2/include/begin_code.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/external/SDL2/CMakeLists.txt b/external/SDL2/CMakeLists.txt index 0128c7ac..7ceb5b85 100644 --- a/external/SDL2/CMakeLists.txt +++ b/external/SDL2/CMakeLists.txt @@ -1772,6 +1772,7 @@ endif() if(SDL_STATIC) set (BUILD_SHARED_LIBS FALSE) add_library(SDL2-static STATIC ${SOURCE_FILES}) + target_compile_definitions(SDL2-static PRIVATE SDL_STATIC) if (NOT SDL_SHARED OR NOT WIN32) set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") # Note: Apparently, OUTPUT_NAME must really be unique; even when diff --git a/external/SDL2/include/begin_code.h b/external/SDL2/include/begin_code.h index 6c210624..197d8e5e 100644 --- a/external/SDL2/include/begin_code.h +++ b/external/SDL2/include/begin_code.h @@ -58,6 +58,8 @@ # else # define DECLSPEC __declspec(dllimport) # endif +# elif defined(SDL_STATIC) +# define DECLSPEC # else # define DECLSPEC __declspec(dllexport) # endif