Fix linking on Msys2.

Do not link `SDL2main` on any WIN32, not just MSVC.

Define `WIN32_CONSOLE_APP` for Debug mode builds on any WIN32, not just
MSVC.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2020-08-28 05:09:58 +00:00
parent e2634df5cc
commit 22a3524c66
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
2 changed files with 7 additions and 7 deletions

View File

@ -158,7 +158,7 @@ ENDIF(MINGW)
IF(SDL2_LIBRARY_TEMP)
# For SDL2main
if(SDL2MAIN_LIBRARY AND NOT MSVC)
if(SDL2MAIN_LIBRARY AND NOT WIN32)
SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
endif()

View File

@ -992,15 +992,15 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()
elseif(MSVC)
# the debug lib libcmtd is linked in debug mode, so don't link the normal version
# also make the app a console app in debug mode
set_target_properties(visualboyadvance-m PROPERTIES LINK_FLAGS_DEBUG "/nodefaultlib:libcmt /subsystem:console")
if(CMAKE_BUILD_TYPE MATCHES Debug)
# to get the debug console mode app to work correctly
target_compile_definitions(visualboyadvance-m PRIVATE -DWIN32_CONSOLE_APP)
endif()
endif()
# Make the app a console app in debug mode to get log messages.
if(WIN32 AND CMAKE_BUILD_TYPE MATCHES Debug)
target_compile_definitions(visualboyadvance-m PRIVATE -DWIN32_CONSOLE_APP)
endif()
if(NOT WIN32 AND NOT APPLE)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/visualboyadvance-m.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/visualboyadvance-m.appdata.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/appdata)