diff options
| author | Cody Jackson <JacksonTech@users.noreply.github.com> | 2019-04-24 11:00:17 -0700 |
|---|---|---|
| committer | jeremyk-lunarg <jeremyk@lunarg.com> | 2019-04-24 13:07:19 -0600 |
| commit | f8d925987ba7e60ae99e9c4cc50a7df326ecdf16 (patch) | |
| tree | 8fb36c4b8f69f15d1776956188a8b3ae3d58a68a | |
| parent | a50b72c09701b905f8ffe66a14f0a1e455b8e851 (diff) | |
| download | usermoji-f8d925987ba7e60ae99e9c4cc50a7df326ecdf16.tar.xz | |
Update CMakeLists.txt
Adds Control Flow Guard compiler flag to vulkaninfo
Control Flow Guard (CG) protects against some forms of memory corruption.
See https://docs.microsoft.com/en-us/windows/desktop/secbp/control-flow-guard for details.
This compiler flag enables CFG on vulkaninfo. (CFG is already enabled on the Cube project.)
Enabling CFG is a low-risk, "set and forget" low hanging fruit for security hardening.
| -rw-r--r-- | vulkaninfo/CMakeLists.txt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/vulkaninfo/CMakeLists.txt b/vulkaninfo/CMakeLists.txt index b9d0dfa8..5a822c4f 100644 --- a/vulkaninfo/CMakeLists.txt +++ b/vulkaninfo/CMakeLists.txt @@ -71,6 +71,13 @@ endif() if(WIN32) target_compile_definitions(vulkaninfo PUBLIC -DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_WARNINGS) + if(NOT MSVC_VERSION LESS 1900) + # Enable control flow guard + message(STATUS "Building vulkaninfo with control flow guard") + add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/guard:cf>") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /guard:cf") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf") + endif() # Use static MSVCRT libraries foreach(configuration |
