Commit 63f9fbee by Philip Kelley

MSVC: Enable Control Flow Guard (CFG)

This feature requires Visual Studio 2015 (MSVC_VERSION = 1900) or later. As the
minimum required CMake version is currently less than 3.7, GREATER_EQUAL is not
available to us and we must invert the result of the LESS operator.
parent 66137ff6
......@@ -137,6 +137,11 @@ IF (MSVC)
# /Gd - explicitly set cdecl calling convention
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd")
IF (NOT (MSVC_VERSION LESS 1900))
# /guard:cf - Enable Control Flow Guard
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf")
ENDIF()
IF (STATIC_CRT)
SET(CRT_FLAG_DEBUG "/MTd")
SET(CRT_FLAG_RELEASE "/MT")
......@@ -183,6 +188,11 @@ IF (MSVC)
# /VERSION - Embed version information in PE header
SET(CMAKE_EXE_LINKER_FLAGS "/DYNAMICBASE /NXCOMPAT /LARGEADDRESSAWARE /VERSION:${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}")
IF (NOT (MSVC_VERSION LESS 1900))
# /GUARD:CF - Enable Control Flow Guard
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /GUARD:CF")
ENDIF()
# /DEBUG - Create a PDB
# /LTCG - Link time code generation (whole program optimization)
# /OPT:REF /OPT:ICF - Fold out duplicate code at link step
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment