diff options
author | Ray Molenkamp <github@lazydodo.com> | 2020-08-27 07:25:40 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2020-08-27 07:25:40 +0300 |
commit | 8b8269389858b54052149a576f1a562e18540862 (patch) | |
tree | 8eb9a9eeb39eab46e5697e453a90f02034ec3f0d /CMakeLists.txt | |
parent | bbf00a6231759f4a6426d6c28be723a915c3a02b (diff) |
MSVC: Set proper flags for C++17 support.
MSVC already builds with the /std:c++17 flag but for
'reasons' [1] MSVC still gives the wrong value for the
__cplusplus define.
This change sets an additional cxx flag on supported
compilers to allow the compiler properly identify
C++17 support.
This resolves 2 warnings coming out of bullet about
the register keyword being deprecated.
[1] https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ac88e81547..87557b6e905 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1571,6 +1571,12 @@ endif() if(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17") + # Make MSVC properly report the value of the __cplusplus preprocessor macro + # Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless + # of the C++ standard chosen above + if(MSVC_VERSION GREATER 1913) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus") + endif() elseif( CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR |