Skip to content

Commit

Permalink
[CMake] Move the setting of LLVM_COMPILER_IS_GCC_COMPATIBLE to a sepa…
Browse files Browse the repository at this point in the history
…rate 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

llvm-svn: 248798
  • Loading branch information
john-brawn-arm committed Sep 29, 2015
1 parent 0f28d62 commit c23801d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions llvm/cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include(LLVMProcessSources)
include(LLVM-Config)
include(DetermineGCCCompatible)

function(llvm_update_compile_flags name)
get_property(sources TARGET ${name} PROPERTY SOURCES)
Expand Down
11 changes: 11 additions & 0 deletions llvm/cmake/modules/DetermineGCCCompatible.cmake
Original file line number Diff line number Diff line change
@@ -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()
10 changes: 2 additions & 8 deletions llvm/cmake/modules/HandleLLVMStdlib.cmake
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit c23801d

Please sign in to comment.