[llvm] r230539 - [CMake] Fix the clang-cl self host build.

Zachary Turner zturner at google.com
Wed Feb 25 12:42:19 PST 2015


Author: zturner
Date: Wed Feb 25 14:42:19 2015
New Revision: 230539

URL: http://llvm.org/viewvc/llvm-project?rev=230539&view=rev
Log:
[CMake] Fix the clang-cl self host build.

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.

Modified:
    llvm/trunk/cmake/modules/AddLLVM.cmake
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake

Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=230539&r1=230538&r2=230539&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Wed Feb 25 14:42:19 2015
@@ -10,7 +10,7 @@ function(llvm_update_compile_flags name)
 
   # 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 CLANG_CL)
     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)
@@ -22,6 +22,10 @@ function(llvm_update_compile_flags name)
       list(APPEND LLVM_COMPILE_DEFINITIONS _HAS_EXCEPTIONS=0)
       list(APPEND LLVM_COMPILE_FLAGS "/EHs-c-")
     endif()
+    if (CLANG_CL)
+      # FIXME: Remove this once clang-cl supports SEH
+      list(APPEND LLVM_COMPILE_DEFINITIONS "GTEST_HAS_SEH=0")
+    endif()
   endif()
 
   # LLVM_REQUIRES_RTTI is an internal flag that individual

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=230539&r1=230538&r2=230539&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Wed Feb 25 14:42:19 2015
@@ -25,6 +25,7 @@ if(NOT LLVM_FORCE_USE_OLD_TOOLCHAIN)
       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)
     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





More information about the llvm-commits mailing list