cmake: make static flags configurable

This commit is contained in:
tobtoht
2026-05-01 11:15:55 +02:00
parent 243a442f53
commit c9424ba470
+6 -4
View File
@@ -995,9 +995,10 @@ include(CheckTrezor)
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) if(STATIC)
# STATIC already configures most deps to be linked in statically, # STATIC already configures most deps to be linked in statically,
# here we make more deps static if the platform permits it # here we make more deps static if the platform permits it
if (NOT DEFINED STATIC_FLAGS)
if (MINGW) if (MINGW)
# On Windows, this is as close to fully-static as we get: # On Windows, this is as close to fully-static as we get:
# this leaves only deps on /c/Windows/system32/*.dll # this leaves only deps on /c/Windows/system32/*.dll
@@ -1006,8 +1007,9 @@ include(CheckTrezor)
# On Linux, we don't support fully static build, but these can be static # On Linux, we don't support fully static build, but these can be static
set(STATIC_FLAGS "-static-libgcc -static-libstdc++") set(STATIC_FLAGS "-static-libgcc -static-libstdc++")
endif() endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${STATIC_FLAGS} ")
endif() endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${STATIC_FLAGS} ")
endif()
set(OLD_LIB_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) set(OLD_LIB_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(Boost_NO_BOOST_CMAKE ON) set(Boost_NO_BOOST_CMAKE ON)