bring in all updates from STATIC_RUNTIME

pull/1002/head
Ryan Tharp 4 years ago
parent 60a36a4a7d
commit 6001215a23

@ -2,6 +2,13 @@ if(NOT STATIC_LINK)
return()
endif()
# not supported on Solaris - system libraries are not available as archives
# LTO is supported only for native builds
if(SOLARIS)
link_libraries( -static-libstdc++ -static-libgcc )
return()
endif()
if(NOT CMAKE_CROSSCOMPILING)
add_compile_options(-static -flto)
else()
@ -9,7 +16,12 @@ else()
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
link_libraries( -flto)
if(APPLE)
link_libraries( -flto)
else()
link_libraries( -static -static-libstdc++ -pthread -flto )
endif()
return()
endif()
@ -19,5 +31,8 @@ if(NOT CMAKE_CROSSCOMPILING)
set(CMAKE_C_ARCHIVE_FINISH "true")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_FINISH "true")
link_libraries( -flto )
link_libraries( -flto -static-libstdc++ -static-libgcc -static ${CMAKE_CXX_FLAGS} ${CRYPTO_FLAGS} )
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static" )
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
endif()

Loading…
Cancel
Save