From 77141e84e07513b2c6f864a9afa9f5c0b10b2e56 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 31 Oct 2021 18:53:11 -0500 Subject: [PATCH] cmake: Fix test linking with MinGW --- test/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index aae1ddc5b..0531568d1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,9 +6,14 @@ project(SDL2 C) remove_definitions(-DUSING_GENERATED_CONFIG_H) link_libraries(SDL2_test SDL2-static) -# FIXME: Parent directory CMakeLists.txt only sets these for mingw/cygwin, -# but we need them for VS as well. if(WINDOWS) + # mingw32 must come before SDL2main to link successfully + if(MINGW OR CYGWIN) + link_libraries(mingw32) + endif() + + # FIXME: Parent directory CMakeLists.txt only sets these for mingw/cygwin, + # but we need them for VS as well. link_libraries(SDL2main) add_definitions(-Dmain=SDL_main) endif()