[llvm] r248798 - [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
Tue Sep 29 07:33:58 PDT 2015


Author: john.brawn
Date: Tue Sep 29 09:33:58 2015
New Revision: 248798

URL: http://llvm.org/viewvc/llvm-project?rev=248798&view=rev
Log:
[CMake] Move the setting of LLVM_COMPILER_IS_GCC_COMPATIBLE to a separate file

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

Added:
    llvm/trunk/cmake/modules/DetermineGCCCompatible.cmake
Modified:
    llvm/trunk/cmake/modules/AddLLVM.cmake
    llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake

Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=248798&r1=248797&r2=248798&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Tue Sep 29 09:33:58 2015
@@ -1,5 +1,6 @@
 include(LLVMProcessSources)
 include(LLVM-Config)
+include(DetermineGCCCompatible)
 
 function(llvm_update_compile_flags name)
   get_property(sources TARGET ${name} PROPERTY SOURCES)

Added: llvm/trunk/cmake/modules/DetermineGCCCompatible.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/DetermineGCCCompatible.cmake?rev=248798&view=auto
==============================================================================
--- llvm/trunk/cmake/modules/DetermineGCCCompatible.cmake (added)
+++ llvm/trunk/cmake/modules/DetermineGCCCompatible.cmake Tue Sep 29 09:33:58 2015
@@ -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()

Modified: llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake?rev=248798&r1=248797&r2=248798&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake Tue Sep 29 09:33:58 2015
@@ -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)




More information about the llvm-commits mailing list