diff options
author | Brad King <brad.king@kitware.com> | 2016-03-10 14:16:16 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-03-10 14:16:16 (GMT) |
commit | 612a8b3bd8091372d9e50a81f05dcab8b31ae35c (patch) | |
tree | c6978e8f12830b4cab6f484d276ec447621072eb /Modules | |
parent | e1b0dedc69a7d6eecaf1fe1d2324434aaac67c74 (diff) | |
parent | 491b41dd988915a3f00259fa704490dfa2f47dc9 (diff) | |
download | CMake-612a8b3bd8091372d9e50a81f05dcab8b31ae35c.zip CMake-612a8b3bd8091372d9e50a81f05dcab8b31ae35c.tar.gz CMake-612a8b3bd8091372d9e50a81f05dcab8b31ae35c.tar.bz2 |
Merge topic 'vs-clang-cl'
491b41dd Help: Add notes for topic 'vs-clang-cl'
ad6d27ac Tests: do not build PrecompiledHeader on Clang/C2
a0f0541f Tests: fix PDBDirectoryAndName on Clang/C2
3541af67 Tests: fix Plugin building on Clang/C2
1902c293 Tests: fix complexOneConfig building on Clang/C2
cab2ec11 Tests: fix Complex building on Clang/C2
ada3736c Tests: fix Module.GenerateExportHeader building on Clang/C2
123b7e13 Tests: fix AliasTarget building on Clang/C2
445d4d4b VS 14: Add flag map for -std= to CppLanguageStandard tag in project files
0a785eb4 Features: Clang has no cxx_decltype_incomplete_return_type in MSVC sim mode
2c2ec488 VS: in Clang/C2 toolset, setup correct compiler settings
37afe00f CMakeDetermineCompilerId: Add detection of clang.exe bundled with VS
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 6 | ||||
-rw-r--r-- | Modules/Compiler/Clang-CXX-TestableFeatures.cmake | 4 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 30 |
3 files changed, 31 insertions, 9 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index feae1c4..fbfd7a9 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -157,7 +157,11 @@ Id flags: ${testflags} set(vs_version ${CMAKE_MATCH_1}) set(id_platform ${CMAKE_VS_PLATFORM_NAME}) set(id_lang "${lang}") - set(id_cl cl.exe) + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") + set(id_cl clang.exe) + else() + set(id_cl cl.exe) + endif() if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") set(v NsightTegra) set(ext vcxproj) diff --git a/Modules/Compiler/Clang-CXX-TestableFeatures.cmake b/Modules/Compiler/Clang-CXX-TestableFeatures.cmake index b39475c..69965a6 100644 --- a/Modules/Compiler/Clang-CXX-TestableFeatures.cmake +++ b/Modules/Compiler/Clang-CXX-TestableFeatures.cmake @@ -8,7 +8,6 @@ set(testable_features cxx_constexpr cxx_contextual_conversions cxx_decltype - cxx_decltype_incomplete_return_types cxx_default_function_template_args cxx_defaulted_functions cxx_delegating_constructors @@ -36,6 +35,9 @@ set(testable_features cxx_variable_templates cxx_variadic_templates ) +if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + list(APPEND testable_features cxx_decltype_incomplete_return_types) +endif() foreach(feature ${testable_features}) set(_cmake_feature_test_${feature} "${_cmake_oldestSupported} && __has_feature(${feature})") diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index a61413a..528cde3 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -194,8 +194,14 @@ else() if(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") elseif(MSVC_VERSION GREATER 1310) - set(_RTC1 "/RTC1") - set(_FLAGS_CXX " /GR /EHsc") + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") + # Clang/C2 in MSVC14 Update 1 seems to not support -fsantinize (yet?) + # set(_RTC1 "-fsantinize=memory,safe-stack") + set(_FLAGS_CXX " -frtti -fexceptions") + else() + set(_RTC1 "/RTC1") + set(_FLAGS_CXX " /GR /EHsc") + endif() set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib") else() set(_RTC1 "/GZ") @@ -296,11 +302,21 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_LINK_EXECUTABLE "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}") - set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}") - set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") + # note: MSVC 14 2015 Update 1 sets -fno-ms-compatibility by default, but this does not allow to compile many projects + # that include MS's own headers. CMake itself is affected project too. + set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} -fms-extensions -fms-compatibility -D_WINDOWS -Wall${_FLAGS_${lang}}") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-D_DEBUG /MDd -gline-tables-only -fno-inline -O0 ${_RTC1}") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD -O2 -D NDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD -gline-tables-only -O2 -fno-inline -D NDEBUG") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD -Os -D NDEBUG") + else() + set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + endif() set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) set(CMAKE_NINJA_DEPTYPE_${lang} msvc) |