From 4e5aa5a29244bc7e75fff92f54f9506638d878c0 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Wed, 19 Aug 2020 15:33:41 +0300 Subject: [PATCH] Fix built-in runtimes. Avoid having to share mingw runtimes with the binary by embedding them in the binary via static linking. --- CMakeLists.txt | 2 +- module/CMakeLists.txt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc8d8e82..a6688cea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ if(CMAKE_BUILD_TYPE MATCHES Debug) add_compile_options(-g) endif() -# Include mingw runntime into the binary +# Include MINGW runtime into the binary if(GCC OR MINGW) if(BUILTIN_RUNTIMES) set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static") diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt index 552b552f..819f7f62 100644 --- a/module/CMakeLists.txt +++ b/module/CMakeLists.txt @@ -73,6 +73,12 @@ add_library(SqModule MODULE Misc/Vehicle.cpp Misc/Vehicle.hpp Misc/Weapon.cpp Misc/Weapon.hpp ) +# Include MINGW runtime into the binary +if(GCC OR MINGW) + if(BUILTIN_RUNTIMES) + target_link_libraries (SqModule -static gcc stdc++ winpthread -dynamic) + endif() +endif() # Link to libraries target_link_libraries(SqModule SqModSDK SimpleINI HashLib B64Lib AES256Lib WhirlpoolLib TinyDir PUGIXML SQLite MaxmindDB SimpleSocket) # Link to mysql client library