[PATCH] D13216: [CMake] Move the setting of LLVM_COMPILER_IS_GCC_COMPATIBLE to a separate file

John Brawn via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 09:04:55 PDT 2015


john.brawn created this revision.
john.brawn added reviewers: chandlerc, chapuni, jordan_rose.
john.brawn added a subscriber: llvm-commits.
john.brawn set the repository for this revision to rL LLVM.

Currently LLVM_COMPILER_IS_GCC_COMPATIBLE is set as a side-effect of determining the stdlib to use in HandleLLVMStdlib, which causes problems when attempting to use AddLLVM from an installed LLVM toolchain, as HandleLLVMStdlib is not used. Move the setting of this variable into DetermineGCCCompatible and include that from both AddLLVM and HandleLLVMStdlib.


Repository:
  rL LLVM

http://reviews.llvm.org/D13216

Files:
  cmake/modules/AddLLVM.cmake
  cmake/modules/DetermineGCCCompatible.cmake
  cmake/modules/HandleLLVMStdlib.cmake

Index: cmake/modules/HandleLLVMStdlib.cmake
===================================================================
--- cmake/modules/HandleLLVMStdlib.cmake
+++ cmake/modules/HandleLLVMStdlib.cmake
@@ -1,17 +1,11 @@
 # This CMake module is responsible for setting the standard library to libc++
 # if the user has requested it.
 
+include(DetermineGCCCompatible)
+
 if(NOT DEFINED LLVM_STDLIB_HANDLED)
   set(LLVM_STDLIB_HANDLED ON)
 
-  if(CMAKE_COMPILER_IS_GNUCXX)
-    set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
-  elseif( MSVC )
-    set(LLVM_COMPILER_IS_GCC_COMPATIBLE OFF)
-  elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
-    set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
-  endif()
-
   function(append value)
     foreach(variable ${ARGN})
       set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
Index: cmake/modules/DetermineGCCCompatible.cmake
===================================================================
--- /dev/null
+++ cmake/modules/DetermineGCCCompatible.cmake
@@ -0,0 +1,11 @@
+# Determine if the compiler has GCC-compatible command-line syntax.
+
+if(NOT DEFINED LLVM_COMPILER_IS_GCC_COMPATIBLE)
+  if(CMAKE_COMPILER_IS_GNUCXX)
+    set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
+  elseif( MSVC )
+    set(LLVM_COMPILER_IS_GCC_COMPATIBLE OFF)
+  elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
+    set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
+  endif()
+endif()
Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -1,5 +1,6 @@
 include(LLVMProcessSources)
 include(LLVM-Config)
+include(DetermineGCCCompatible)
 
 function(llvm_update_compile_flags name)
   get_property(sources TARGET ${name} PROPERTY SOURCES)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13216.35878.patch
Type: text/x-patch
Size: 1752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150928/9f0609c4/attachment.bin>


More information about the llvm-commits mailing list