Index: llvm/trunk/cmake/modules/AddLLVM.cmake =================================================================== --- llvm/trunk/cmake/modules/AddLLVM.cmake +++ llvm/trunk/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) Index: llvm/trunk/cmake/modules/DetermineGCCCompatible.cmake =================================================================== --- llvm/trunk/cmake/modules/DetermineGCCCompatible.cmake +++ llvm/trunk/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: llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake =================================================================== --- llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake +++ llvm/trunk/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)