From a9750f912db1d81e163747472e40a52da032b185 Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Wed, 19 Jan 2022 22:12:04 -0500 Subject: Add SDL2Config.cmake workarounds for MinGW compiler --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f720c5b..ce4e2f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,8 +14,16 @@ endif() add_executable(sol sol.c) add_executable(freecell freecell.c) -target_link_libraries(sol cards SDL2::SDL2 SDL2::SDL2main) -target_link_libraries(freecell cards SDL2::SDL2 SDL2::SDL2main) +# Workaround possible bugs in SDL2Config.cmake +if(MINGW) + target_link_libraries(sol mingw32) # -lmingw32 -lSDL2main -lSDL2 in that order. + target_link_libraries(freecell mingw32) + set_target_properties(sol PROPERTIES WIN32_EXECUTABLE 1) # -mwindows + set_target_properties(freecell PROPERTIES WIN32_EXECUTABLE 1) +endif() + +target_link_libraries(sol cards SDL2::SDL2main SDL2::SDL2) +target_link_libraries(freecell cards SDL2::SDL2main SDL2::SDL2) # Avoid conflicting with SOL.EXE, FREECELL.EXE on Windows if(WIN32) -- cgit 1.4.1