diff options
| -rw-r--r-- | CMakeLists.txt | 8 | ||||
| -rw-r--r-- | demos/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | 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("$<$<CXX_COMPILER_ID:MSVC>:/w34701>") add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/w34703>") - - if (NOT MSVC_VERSION LESS 1900) - # Enable control flow guard - message(STATUS "Building 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() 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("$<$<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() 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("$<$<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() elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR) elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
