Commit 84039e2514350804076c7bb576372a80e2ff2cd8

Anonymous Maarten 2022-11-29T17:47:30

cmake: use target_link_libraries to pass -Wl,--undefined=WinMain (cherry-picked from commit e2060de714481ed58b6a2e781f7439090003a7b4)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ada68e..75068d8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3304,11 +3304,10 @@ if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN)
     target_link_libraries(SDL2main PRIVATE shell32)
   endif()
   if(MINGW OR CYGWIN)
-    cmake_minimum_required(VERSION 3.13)
     if(CMAKE_SIZEOF_VOID_P EQUAL 4)
-      target_link_options(SDL2main PUBLIC "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--undefined=_WinMain@16>")
+      target_link_libraries(SDL2main PUBLIC "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--undefined=_WinMain@16>")
     else()
-      target_link_options(SDL2main PUBLIC "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--undefined=WinMain>")
+      target_link_libraries(SDL2main PUBLIC "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--undefined=WinMain>")
     endif()
   endif()
   if (NOT ANDROID)