CMake: check for /Qspectre before using it

The linked blog entry for /Qspectre suggests intention to include
/Qspectre support for VS 2015 Update 3, but this has not happened yet
(at least, not with VS Community 2015 14.0.23107.178).

Change-Id: I001c8fa512457f1edc753b460634f13d2ff0ed7a
Fixes: v2.5.1rc0-611-g0ebcd27377 ("Trust CMake's Visual C++ version detection.")
Reviewed-on: https://code.wireshark.org/review/27225
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Peter Wu 2018-04-30 16:14:26 +02:00 committed by Gerald Combs
parent 30c0d7ba49
commit e7cd78d4b3
1 changed files with 3 additions and 1 deletions

View File

@ -336,8 +336,10 @@ if( CMAKE_C_COMPILER_ID MATCHES "MSVC")
# https://gitlab.kitware.com/cmake/cmake/commit/f973d49ab9d4c59b93f6dac812a94bb130200836
# /Qspectre Speculative execution attack mitigation
# See https://blogs.msdn.microsoft.com/vcblog/2018/01/15/spectre-mitigations-in-msvc/
list(APPEND LOCAL_CFLAGS /Zo /utf-8 /guard:cf /Qspectre)
list(APPEND LOCAL_CFLAGS /Zo /utf-8 /guard:cf)
set(WS_LINK_FLAGS "${WS_LINK_FLAGS} /guard:cf")
# /Qspectre is not available for VS2015 or older VS2017. Test for its availability.
set(WIRESHARK_COMMON_FLAGS /Qspectre)
endif()
if(ENABLE_CODE_ANALYSIS)