From 22a3524c661786fa0ab68933c626c3796409f9a4 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Fri, 28 Aug 2020 05:09:58 +0000 Subject: [PATCH] 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 --- cmake/FindSDL2.cmake | 2 +- src/wx/CMakeLists.txt | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmake/FindSDL2.cmake b/cmake/FindSDL2.cmake index 966f00bb..bf47c2f0 100644 --- a/cmake/FindSDL2.cmake +++ b/cmake/FindSDL2.cmake @@ -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() diff --git a/src/wx/CMakeLists.txt b/src/wx/CMakeLists.txt index 9e15ebdc..d17d2f5c 100644 --- a/src/wx/CMakeLists.txt +++ b/src/wx/CMakeLists.txt @@ -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)