[CMake] Move the setting of LLVM_COMPILER_IS_GCC_COMPATIBLE to a separate file
authorJohn Brawn <john.brawn@arm.com>
Tue, 29 Sep 2015 14:33:58 +0000 (14:33 +0000)
committerJohn Brawn <john.brawn@arm.com>
Tue, 29 Sep 2015 14:33:58 +0000 (14:33 +0000)
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.

Differential Revision: http://reviews.llvm.org/D13216

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248798 91177308-0d34-0410-b5e6-96231b3b80d8

cmake/modules/AddLLVM.cmake
cmake/modules/DetermineGCCCompatible.cmake [new file with mode: 0644]
cmake/modules/HandleLLVMStdlib.cmake

index dea560182a4bc970a4f0359b8ffd68f1a5972757..48532288fa6e2d510df4651985d16dd77ebd09e9 100644 (file)
@@ -1,5 +1,6 @@
 include(LLVMProcessSources)
 include(LLVM-Config)
+include(DetermineGCCCompatible)
 
 function(llvm_update_compile_flags name)
   get_property(sources TARGET ${name} PROPERTY SOURCES)
diff --git a/cmake/modules/DetermineGCCCompatible.cmake b/cmake/modules/DetermineGCCCompatible.cmake
new file mode 100644 (file)
index 0000000..1bf15fc
--- /dev/null
@@ -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 66ad078fb66eea495ac64a387f201dc36b535eee..b07781c3f2909dd958b27bb84abf3acf6fed28b1 100644 (file)
@@ -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)