From 3e3d249fae2bef697f30c1e32f1e84ad259e688c Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Thu, 5 Oct 2017 11:18:52 -0600 Subject: build: Limit control flow guard to loader/demos Change-Id: Ibb95a7192bd95195797d3d10ccc0ed34fe030268 --- CMakeLists.txt | 8 -------- demos/CMakeLists.txt | 7 +++++++ loader/CMakeLists.txt | 7 +++++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1f5e758..0b4abd2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,14 +85,6 @@ if(WIN32) # Warn about potentially uninitialized variables add_compile_options("$<$:/w34701>") add_compile_options("$<$:/w34703>") - - if (NOT MSVC_VERSION LESS 1900) - # Enable control flow guard - message(STATUS "Building with control flow guard") - add_compile_options("$<$:/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() endif() if(NOT WIN32) diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt index b9ea9d01..eb07b4af 100644 --- a/demos/CMakeLists.txt +++ b/demos/CMakeLists.txt @@ -1,6 +1,13 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN) set(DisplayServer Win32) + if (NOT MSVC_VERSION LESS 1900) + # Enable control flow guard + message(STATUS "Building demos with control flow guard") + add_compile_options("$<$:/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() elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR) elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 0978d691..9c8173fa 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -23,6 +23,13 @@ endif() if(CMAKE_SYSTEM_NAME STREQUAL "Windows") add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN) set(DisplayServer Win32) + if (NOT MSVC_VERSION LESS 1900) + # Enable control flow guard + message(STATUS "Building loader with control flow guard") + add_compile_options("$<$:/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() elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR) elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") -- cgit v1.2.3