From 38a1ba44d46e99374582215d7661c650613c7584 Mon Sep 17 00:00:00 2001 From: Alexey Sotkin Date: Tue, 30 Jul 2019 15:01:40 +0300 Subject: [PATCH] Enable compiler generation of CFG security checks --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6711791f..fc57aa97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,6 +294,11 @@ if (WIN32) "RC_PRODUCT_NAME=\"${RC_PRODUCT_NAME}\"" "RC_PRODUCT_VERSION=\"${RC_FILE_VERSION}\"" "RC_COPYRIGHT=\"Copyright ${RC_CHAR_C} 2018 Intel Corporation. All rights reserved.\"") + # Enable compiler generation of Control Flow Guard security checks. + target_compile_options(${TARGET_NAME} PUBLIC "/guard:cf") + set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY + LINK_FLAGS "/DYNAMICBASE /GUARD:CF") + elseif(UNIX) set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY COMPILE_DEFINITIONS LIBCOMMON_CLANG_NAME="$")