From d0aad1c2cf1c734c650d277d4ad61b3e593a9d01 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 14 May 2020 17:14:48 +0200 Subject: Only statically link to libc++ if there are c++ files in the project --- backend/ninja/Ninja.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'backend') diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index 68b3d05..7bdcbaa 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -1273,7 +1273,12 @@ namespace backend case Compiler::MINGW_W64: case Compiler::GCC: { - packagingFlags = "-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic"; + if(usesCFiles) { + packagingFlags += " -static-libgcc"; + } + if(usesCppFiles) { + packagingFlags += " -static-libstdc++ -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic"; + } break; } case Compiler::MSVC: @@ -1287,7 +1292,12 @@ namespace backend { if(config.getCompiler() == Compiler::MINGW_W64) { - packagingFlags = "-static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic"; + if(usesCFiles) { + packagingFlags += " -static-libgcc"; + } + if(usesCppFiles) { + packagingFlags += " -static-libstdc++ -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic"; + } } } -- cgit v1.2.3