From 2bc326e766701e4521fcda3b00271c0b2a122b4a Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Thu, 2 Feb 2023 11:05:04 +0800 Subject: [PATCH] update Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- utils.cmake | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/utils.cmake b/utils.cmake index 4167c6f..0e6d236 100644 --- a/utils.cmake +++ b/utils.cmake @@ -327,9 +327,10 @@ function(setup_compile_params) endif() endif() else() + # MinGW can also use these flags. target_compile_options(${__target} PRIVATE -Wall -Wextra -Werror - $<$>:-ffunction-sections -fdata-sections> # -fcf-protection=full? -Wa,-mno-branches-within-32B-boundaries? + $<$>:-ffunction-sections -fdata-sections> ) if(APPLE) target_link_options(${__target} PRIVATE @@ -340,7 +341,25 @@ function(setup_compile_params) $<$>:-Wl,--gc-sections> ) endif() - # TODO: spectre, control flow guard + if(MINGW) # llvm-mingw + target_compile_options(${__target} PRIVATE + $<$>:-mguard=cf> + ) + target_link_options(${__target} PRIVATE + $<$>:-Wl,--guard-cf> + ) + elseif(CLANG) + # -Wa,--x86-branches-within-32B-boundaries + target_compile_options(${__target} PRIVATE + $<$>:-mbranches-within-32B-boundaries> + ) + else() # GCC + # Can we remove "-Wa" now? + target_compile_options(${__target} PRIVATE + $<$>:-Wa,-mbranches-within-32B-boundaries -fcf-protection=full> + ) + endif() + # TODO: spectre & control flow guard & intel cet for Clang & GCC. endif() endforeach() endfunction() @@ -597,6 +616,7 @@ function(deploy_qt_runtime) "${CMAKE_COMMAND}" -E rm -rf "$/translations" + "$/qml/translations" "$/../qml/translations" ) if(NOT DEPLOY_ARGS_NO_INSTALL)