From 043ab9ce779de27f8dbe7f4f08dfa48dfc5ca9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 19 Dec 2021 09:44:26 +0100 Subject: [PATCH] MSVC workarounds should apply to all non-MinGW builds --- src/CMakeLists.txt | 6 +++--- src/win/CMakeLists.txt | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0c2f9d4e5..00d369aff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -57,10 +57,10 @@ target_link_libraries(86Box cpu chipset mch dev mem fdd game cdrom zip mo hdd net print scsi sio snd vid voodoo plat ui) if(WIN32 AND ARCH STREQUAL "i386") - if(MSVC) - target_link_options(86Box PRIVATE "/LARGEADDRESSAWARE") - else() + if(MINGW) target_link_options(86Box PRIVATE "LINKER:--large-address-aware") + else() + target_link_options(86Box PRIVATE "LINKER:/LARGEADDRESSAWARE") endif() endif() diff --git a/src/win/CMakeLists.txt b/src/win/CMakeLists.txt index 9b0016e6f..b44cb7c6c 100644 --- a/src/win/CMakeLists.txt +++ b/src/win/CMakeLists.txt @@ -27,18 +27,18 @@ if(NOT CPPTHREADS) target_sources(plat PRIVATE win_thread.c) endif() -if(MSVC) - # MSVC complains when we include the manifest from 86Box.rc... - # On the bright side, CMake supports passing the manifest as a source - # file when using MSVC, so we might just as well do that! - target_compile_definitions(ui PRIVATE NO_INCLUDE_MANIFEST) +if(NOT MINGW) + # MSVC linker adds its own manifest to the executable, which fails if + # we include ours in 86Box.rc. We therefore need to pass the manifest + # directly as as a source file, so the linker can use that instead. + set_property(SOURCE 86Box.rc PROPERTY COMPILE_DEFINITIONS NO_INCLUDE_MANIFEST) target_sources(86Box PRIVATE 86Box.manifest) # Append null to resource strings (fixes file dialogs) set_property(SOURCE 86Box.rc PROPERTY COMPILE_FLAGS -n) -endif() -if(NOT MINGW) + # `opendir` is only included in MinGW, so include an implementation + # for other builds. target_sources(plat PRIVATE win_opendir.c) endif()