summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam D. Jones <thor0505@comcast.net>2022-01-19 22:12:04 -0500
committerJune McEnroe <june@causal.agency>2022-01-19 22:23:22 -0500
commita9750f912db1d81e163747472e40a52da032b185 (patch)
treee86e6d2240fbd9834986c4b55baa108884ca29e3
parentOnly require C (diff)
downloadwep-a9750f912db1d81e163747472e40a52da032b185.tar.gz
wep-a9750f912db1d81e163747472e40a52da032b185.zip
Add SDL2Config.cmake workarounds for MinGW compiler
Diffstat (limited to '')
-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)