aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-08-28 22:48:09 +0200
committerRiccardo Spagni <ric@spagni.net>2016-08-28 22:48:09 +0200
commitc706035c128e41e00428179b9ad20fa93d9d9c51 (patch)
treef11281fa291d879f3019bd38f8c1ca512914ff3a
parentMerge pull request #994 (diff)
parentcmake: pass -static when STATIC=ON on Windows (diff)
downloadmonero-c706035c128e41e00428179b9ad20fa93d9d9c51.tar.xz
Merge pull request #995
94de4b0 cmake: pass -static when STATIC=ON on Windows (redfish)
-rw-r--r--CMakeLists.txt14
1 files changed, 12 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 675650b0f..bb8a621d7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -426,8 +426,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()