diff options
author | Ruben Van Boxem <vanboxem.ruben@gmail.com> | 2018-04-07 08:42:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-04-11 18:50:22 (GMT) |
commit | 3f82c5904d89a892a51476898439cf4d99660fb4 (patch) | |
tree | a3b7e505748a021d572bf69e8f0283f2eea65fe3 /Modules/Compiler/Clang-CXX.cmake | |
parent | 8381bc12add724f1f262601b155485164b1842b1 (diff) | |
download | CMake-3f82c5904d89a892a51476898439cf4d99660fb4.zip CMake-3f82c5904d89a892a51476898439cf4d99660fb4.tar.gz CMake-3f82c5904d89a892a51476898439cf4d99660fb4.tar.bz2 |
Clang: Add standard flags support when simulating MSVC
When Clang 3.9 simulates MSVC 19.0 or higher it knows the `-std:` flags
that such versions of MSVC defines.
Fixes: #17866
Diffstat (limited to 'Modules/Compiler/Clang-CXX.cmake')
-rw-r--r-- | Modules/Compiler/Clang-CXX.cmake | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index b24aaf4..e99011b 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -53,6 +53,27 @@ if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") unset(_clang_version_std17) __compiler_check_default_language_standard(CXX 2.1 98) +elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 3.9 + AND CMAKE_CXX_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.0) + # This version of clang-cl and the MSVC version it simulates have + # support for -std: flags. + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std:c++14") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std:c++14") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0) + set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std:c++17") + set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++17") + set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest") + set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++latest") + else() + set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std:c++latest") + set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++latest") + endif() + + __compiler_check_default_language_standard(CXX 3.9 14) else() # This version of clang-cl, or the MSVC version it simulates, does not have # language standards. Set these options as empty strings so the feature |