cmake: only add -Wl,--undefined=WinMain when building an executable

This commit is contained in:
Anonymous Maarten
2022-09-19 02:38:36 +02:00
committed by Ozkan Sezer
parent c833294817
commit 3b20e0ecef
3 changed files with 59 additions and 2 deletions

View File

@@ -3049,9 +3049,9 @@ if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN)
if(MINGW OR CYGWIN)
cmake_minimum_required(VERSION 3.13)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
target_link_options(SDL2main PUBLIC "-Wl,--undefined=_WinMain@16")
target_link_options(SDL2main PUBLIC "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--undefined=_WinMain@16>")
else()
target_link_options(SDL2main PUBLIC "-Wl,--undefined=WinMain")
target_link_options(SDL2main PUBLIC "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--undefined=WinMain>")
endif()
endif()
if (NOT ANDROID)