diff options
| author | Reid Kleckner <rnk@google.com> | 2016-03-30 17:30:26 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2016-03-30 17:30:26 +0000 |
| commit | 2b3db2c1bb435fca17ce45675e1f5c63e3ea91f4 (patch) | |
| tree | 30e6043a47de071941c2d1e74a15ef9e2e7bf8c4 | |
| parent | 8c18019d50127a79c92d6f6017bad0c0c83441d4 (diff) | |
| download | bcm5719-llvm-2b3db2c1bb435fca17ce45675e1f5c63e3ea91f4.tar.gz bcm5719-llvm-2b3db2c1bb435fca17ce45675e1f5c63e3ea91f4.zip | |
[cmake] Add -fms-compatibility-version=19 when clang-cl gives errors about char16_t
What we are really trying to do here is to figure out if we are using
the 2015 STL. Unfortunately, so far as I know the MSVC STL does not
define a version macro that we can check directly. Instead I wrote a
check to see if char16_t works.
llvm-svn: 264881
| -rw-r--r-- | llvm/cmake/modules/HandleLLVMOptions.cmake | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index 7036e742873..83c8fe6b767 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -347,6 +347,17 @@ if( MSVC ) # "Enforce type conversion rules". append("/Zc:rvalueCast" CMAKE_CXX_FLAGS) + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # In VS 2015, char16_t became a builtin type. Clang still defaults to VS + # 2013 compatibility, where it cannot be a builtin type. If we're using an + # STL newer than 2015, this compilation will fail. Rasing the MSVC + # compatibility version of the compiler will provide char16/32. + check_cxx_source_compiles("#include <cstdint>\nchar16_t v1;\n" STL_PROVIDES_CHAR16_T) + if (NOT STL_PROVIDES_CHAR16_T) + append("-fms-compatibility-version=19" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + endif() + endif() + if (NOT LLVM_ENABLE_TIMESTAMPS AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") # clang-cl and cl by default produce non-deterministic binaries because # link.exe /incremental requires a timestamp in the .obj file. clang-cl |

