mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-26 17:32:33 +00:00
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.
This commit is contained in:
parent
a569b264bc
commit
94de4b040c
1 changed files with 12 additions and 2 deletions
|
@ -430,8 +430,18 @@ else()
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_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)
|
if(STATIC)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
# 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()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue