Make clang use libc++ by default#5943
Conversation
|
I tested this with [email protected] and it works for me, see #5942 (comment). But I think this cmake option is not available in older LLVM versions, so this PR needs to be improved to take this into account. |
| if '+libcxx' not in spec: | ||
| cmake_args.append('-DLLVM_EXTERNAL_LIBCXX_BUILD:Bool=OFF') | ||
| cmake_args.append('-DLLVM_EXTERNAL_LIBCXXABI_BUILD:Bool=OFF') | ||
| else: |
There was a problem hiding this comment.
i think it would be easier to read if you do
if '+libcxx' in spec:
cmake_args.append('-DCLANG_DEFAULT_CXX_STDLIB=libc++')
else:
// old code
|
@certik: can you add the version check to the conditional? |
|
It looks like this option has been introduced by this commit: llvm-mirror/clang@1b363a4, so we just need to figure out what version of LLVM that was by using: and from this we can see that LLVM 3.9 and up support this. |
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 spack#5942.
dad4828 to
4cdacf0
Compare
|
Could this please be merged? So that I have one less branch to worry about. |
|
Thanks @junghans. |
|
For anybody landing here from Google, it should be noted that this behaviour has now been reverted by #19933. |
Fixes #5942.