mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-11-09 16:18:34 +01:00
cc-wrapper: use -cxx-isystem instead of -isystem on Clang
This allows Clang to always look for the libc++ headers when compling C++ code (regardless of whether it is invoked with `clang` or `clang++` while not exposing the headers when compiling plain C code. See https://releases.llvm.org/21.1.0/tools/clang/docs/ClangCommandLineReference.html#cmdoption-clang-cxx-isystem-directory
This commit is contained in:
parent
bd0dd33de1
commit
76a8ffa6d8
|
|
@ -741,14 +741,14 @@ stdenvNoCC.mkDerivation {
|
|||
# https://github.com/NixOS/nixpkgs/pull/209870#issuecomment-1500550903)
|
||||
+ optionalString (libcxx == null && isClang && (useGccForLibs && gccForLibs.langCC or false)) ''
|
||||
for dir in ${gccForLibs}/include/c++/*; do
|
||||
include -isystem "$dir" >> $out/nix-support/libcxx-cxxflags
|
||||
include -cxx-isystem "$dir" >> $out/nix-support/libcxx-cxxflags
|
||||
done
|
||||
for dir in ${gccForLibs}/include/c++/*/${targetPlatform.config}; do
|
||||
include -isystem "$dir" >> $out/nix-support/libcxx-cxxflags
|
||||
include -cxx-isystem "$dir" >> $out/nix-support/libcxx-cxxflags
|
||||
done
|
||||
''
|
||||
+ optionalString (libcxx.isLLVM or false) ''
|
||||
include -isystem "${getDev libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
|
||||
include -cxx-isystem "${getDev libcxx}/include/c++/v1" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-stdlib=libc++" >> $out/nix-support/libcxx-ldflags
|
||||
''
|
||||
# GCC NG friendly libc++
|
||||
|
|
|
|||
Loading…
Reference in a new issue