aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt14
1 files changed, 12 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5ac4a2f95..e9285b012 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -430,8 +430,18 @@ else()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
- if(STATIC AND NOT APPLE AND NOT FREEBSD AND NOT OPENBSD)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
+ if(STATIC)
+ # STATIC already configures most deps to be linked in statically,
+ # here we make more deps static if the platform permits it
+ if (MINGW)
+ # On Windows, this is as close to fully-static as we get:
+ # this leaves only deps on /c/Windows/system32/*.dll
+ set(STATIC_FLAGS "-static")
+ elseif (NOT (APPLE OR FREEBSD OR OPENBSD))
+ # On Linux, we don't support fully static build, but these can be static
+ set(STATIC_FLAGS "-static-libgcc -static-libstdc++")
+ endif()
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${STATIC_FLAGS} ")
endif()
endif()