aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorredfish <redfish@galactica.pw>2016-08-27 18:47:07 -0400
committerredfish <redfish@galactica.pw>2016-08-27 20:26:39 -0400
commit94de4b040c7da63f279c5fe2eaf906b8817b057e (patch)
tree4edabdfc64e9de5f15dde7635f38aaf7f8fd3306 /CMakeLists.txt
parentMerge pull request #991 (diff)
downloadmonero-94de4b040c7da63f279c5fe2eaf906b8817b057e.tar.xz
cmake: pass -static when STATIC=ON on Windows
This gets rid of bitmonerod.exe's dependecy on libwindpthreads-1.dll in build on Windows on x86_64 (via MSYS2 default toolchain). With this patch all DLL dependencies are on DLLs in c:\windows\system32.
Diffstat (limited to 'CMakeLists.txt')
-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()