move --gc-sections to shared libraries only

This commit is contained in:
veclav talica 2024-10-18 20:40:54 +03:00
parent 73b6ab047d
commit 399b199266

View File

@ -161,7 +161,6 @@ function(give_options_without_warnings target)
-O3
-flto=$<IF:$<STREQUAL:${CMAKE_C_COMPILER_ID},Clang>,thin,auto>
-mavx -mavx2
-Wl,--gc-sections
-fdata-sections
-ffunction-sections
-funroll-loops
@ -177,6 +176,7 @@ function(give_options_without_warnings target)
$<$<BOOL:${EMSCRIPTEN}>:-gsource-map>)
set(BUILD_SHARED_LIBRARY_FLAGS_RELEASE
-Wl,--gc-sections # TODO: is it even needed with LTO?
$<$<STREQUAL:${CMAKE_C_COMPILER_ID},Clang>:-Wl,-plugin-opt,cache-dir=${CMAKE_CURRENT_BINARY_DIR}/linker-cache/>
$<$<STREQUAL:${CMAKE_C_COMPILER_ID},Clang>:-Wl,-plugin-opt,cache-policy=prune_after=30m>)