summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-11 18:44:04 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-11 18:45:16 (GMT)
commit6cddf7ba324a4cc5ce102e1c48d27ee7e9022b16 (patch)
tree6b131c9499385da04449e762715940515294f668 /Modules/Compiler
parentaad0967e7d367ed3d51a396397a4bcf332c34753 (diff)
downloadCMake-6cddf7ba324a4cc5ce102e1c48d27ee7e9022b16.zip
CMake-6cddf7ba324a4cc5ce102e1c48d27ee7e9022b16.tar.gz
CMake-6cddf7ba324a4cc5ce102e1c48d27ee7e9022b16.tar.bz2
Clang: Refactor standard flags logic when simulating MSVC
Consolidate the compile options and standard defaults branches. Add comments.
Diffstat (limited to 'Modules/Compiler')
-rw-r--r--Modules/Compiler/Clang-CXX.cmake11
1 files changed, 6 insertions, 5 deletions
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index 77866e9..c5dd081 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -51,8 +51,12 @@ if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
endif()
unset(_clang_version_std17)
+
+ __compiler_check_default_language_standard(CXX 2.1 98)
else()
- # clang-cl does not know these options because it behaves like cl.exe
+ # 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
+ # test infrastructure can at least check to see if they are defined.
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "")
@@ -63,10 +67,7 @@ else()
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "")
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "")
-endif()
-if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
- __compiler_check_default_language_standard(CXX 2.1 98)
-else()
+ # There is no meaningful default for this
set(CMAKE_CXX_STANDARD_DEFAULT "")
endif()