From fd7cca70627637f0fc72cc9fd8f81af8ec7a1a44 Mon Sep 17 00:00:00 2001 From: verylowfreq <60875431+verylowfreq@users.noreply.github.com> Date: Mon, 15 Aug 2022 09:48:14 +0900 Subject: [PATCH] Fix CMake files for MinGW. --- CMakeLists.txt | 11 +++++++---- cmake/Toolchain-mingw32.cmake | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f82e08576..62a7a90fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,10 +91,13 @@ endif() if(MINGW) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") - # Link 32 bit SolveSpace with --large-address-aware which allows it to access - # up to 3GB on a properly configured 32 bit Windows and up to 4GB on 64 bit. - # See https://msdn.microsoft.com/en-us/library/aa366778 - set(CMAKE_EXE_LINKER_FLAGS "-Wl,--large-address-aware") + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686") + # Link 32 bit SolveSpace with --large-address-aware which allows it to access + # up to 3GB on a properly configured 32 bit Windows and up to 4GB on 64 bit. + # See https://msdn.microsoft.com/en-us/library/aa366778 + # This option is unavailable for 64-bit executable linking. + set(CMAKE_EXE_LINKER_FLAGS "-Wl,--large-address-aware") + endif() endif() # Ensure that all platforms use 64-bit IEEE floating point operations for consistency; diff --git a/cmake/Toolchain-mingw32.cmake b/cmake/Toolchain-mingw32.cmake index a8767fddd..8658fc29b 100644 --- a/cmake/Toolchain-mingw32.cmake +++ b/cmake/Toolchain-mingw32.cmake @@ -1,4 +1,5 @@ set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR i686) set(TRIPLE i686-w64-mingw32)