diff --git a/depends/Makefile b/depends/Makefile index ab17e43631fa4..7cf0656b06fac 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -286,6 +286,7 @@ $(host_prefix)/share/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_ -e 's|@no_upnp@|$(NO_UPNP)|' \ -e 's|@no_natpmp@|$(NO_NATPMP)|' \ -e 's|@no_usdt@|$(NO_USDT)|' \ + -e 's|@lto@|$(LTO)|' \ $< > $@ touch $@ diff --git a/depends/toolchain.cmake.in b/depends/toolchain.cmake.in index 27949803299e8..d6688d2ff747b 100644 --- a/depends/toolchain.cmake.in +++ b/depends/toolchain.cmake.in @@ -126,6 +126,11 @@ if(NOT WITH_USDT AND "@no_usdt@" STREQUAL "1") set(WITH_USDT OFF CACHE STRING "") endif() +if(NOT LTO AND "@lto@" STREQUAL "1") + set(LTO ON CACHE STRING "") + set(LTO_FLAGS -flto CACHE STRING "") +endif() + if(DEFINED ENV{PYTHONPATH}) set(PYTHONPATH "@depends_prefix@/native/lib/python3/dist-packages:$ENV{PYTHONPATH}") else()