summary refs log tree commit diff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt12
1 files 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)