[PATCH] [CMake] Finish off the clang-cl self host build
Zachary Turner
zturner at google.com
Tue Feb 24 17:19:59 PST 2015
Hi rnk,
This allows clang-cl to self-host cleanly with no magic setup
steps required.
After this patch, all you have to do is set CC=CXX=clang-cl and
run cmake -G Ninja.
These changes only exist to support C++ features which are
unsupported in clang-cl, so regardless of whether the user
specifies they want to use them, we still have to disable them.
http://reviews.llvm.org/D7875
Files:
cmake/modules/AddLLVM.cmake
cmake/modules/HandleLLVMOptions.cmake
Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -10,7 +10,7 @@
# LLVM_REQUIRES_EH is an internal flag that individual
# targets can use to force EH
- if(LLVM_REQUIRES_EH OR LLVM_ENABLE_EH)
+ if((LLVM_REQUIRES_EH OR LLVM_ENABLE_EH) AND NOT LLVM_EH_UNSUPPORTED)
if(NOT (LLVM_REQUIRES_RTTI OR LLVM_ENABLE_RTTI))
message(AUTHOR_WARNING "Exception handling requires RTTI. Enabling RTTI for ${name}")
set(LLVM_REQUIRES_RTTI ON)
@@ -20,6 +20,7 @@
list(APPEND LLVM_COMPILE_FLAGS "-fno-exceptions")
elseif(MSVC)
list(APPEND LLVM_COMPILE_DEFINITIONS _HAS_EXCEPTIONS=0)
+ list(APPEND LLVM_COMPILE_DEFINITIONS "GTEST_HAS_SEH=0")
list(APPEND LLVM_COMPILE_FLAGS "/EHs-c-")
endif()
endif()
Index: cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -25,6 +25,12 @@
if (CMAKE_CXX_SIMULATE_VERSION VERSION_LESS 18.0)
message(FATAL_ERROR "Host Clang must have at least -fms-compatibility-version=18.0")
endif()
+
+ set(CLANG_CL 1)
+ set(LLVM_EH_UNSUPPORTED 0)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
+
elseif(NOT LLVM_ENABLE_LIBCXX)
# Otherwise, test that we aren't using too old of a version of libstdc++
# with the Clang compiler. This is tricky as there is no real way to
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7875.20649.patch
Type: text/x-patch
Size: 1632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150225/ecf3d36c/attachment.bin>
More information about the llvm-commits
mailing list