From 8097a30a6869531c775b4f7b5b04223cabdf873a Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Thu, 13 Oct 2022 11:55:06 +0800 Subject: [PATCH] fix macos build Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- src/core/cmakehelper.cmake | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/cmakehelper.cmake b/src/core/cmakehelper.cmake index f8e0588..57a27e2 100644 --- a/src/core/cmakehelper.cmake +++ b/src/core/cmakehelper.cmake @@ -67,9 +67,15 @@ function(setup_compile_params arg_target) -Wall -Wextra -Werror $<$>:-ffunction-sections -fdata-sections> # -fcf-protection=full? -Wa,-mno-branches-within-32B-boundaries? ) - target_link_options(${arg_target} PRIVATE - $<$>:-Wl,--gc-sections> - ) + if(APPLE) + target_link_options(${arg_target} PRIVATE + $<$>:-Wl,-dead_strip> + ) + else() + target_link_options(${arg_target} PRIVATE + $<$>:-Wl,--gc-sections> + ) + endif() #[[if(CLANG) target_compile_options(${arg_target} PRIVATE $<$>:-Xclang -cfguard -mretpoline>