From 89b0a09de02e7381f44b65b5f60c6f51bd26ccbf Mon Sep 17 00:00:00 2001 From: Ondřej Čertík Date: Wed, 25 Oct 2017 16:19:32 -0600 Subject: Make clang use libc++ by default (#5943) Since LLVM 3.9 Clang can use the libc++ library by default using the CLANG_DEFAULT_CXX_STDLIB cmake configuration variable, without having to specify the -stdlib=libc++ option on the clang++ command line. This commit makes clang++ use libc++ by default for LLVM 3.9 and later if the libcxx variant is on. Fixes #5942. --- var/spack/repos/builtin/packages/llvm/package.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py index 450b2a0ec0..83e172018b 100644 --- a/var/spack/repos/builtin/packages/llvm/package.py +++ b/var/spack/repos/builtin/packages/llvm/package.py @@ -390,7 +390,10 @@ class Llvm(CMakePackage): '-DLLVM_TOOL_LLDB_BUILD:Bool=OFF']) if '+internal_unwind' not in spec: cmake_args.append('-DLLVM_EXTERNAL_LIBUNWIND_BUILD:Bool=OFF') - if '+libcxx' not in spec: + if '+libcxx' in spec: + if spec.satisfies('@3.9.0:'): + cmake_args.append('-DCLANG_DEFAULT_CXX_STDLIB=libc++') + else: cmake_args.append('-DLLVM_EXTERNAL_LIBCXX_BUILD:Bool=OFF') cmake_args.append('-DLLVM_EXTERNAL_LIBCXXABI_BUILD:Bool=OFF') if '+compiler-rt' not in spec: -- cgit v1.2.3-70-g09d2