我在 cmake 上使用启动器进行了以下 clang 调用ccache
:
clang="clang.sh"
将所有内容转发到的变量/usr/local/opt/llvm@12/bin/clang++
。
cd /Users/.../.conan/data/base/v1.1.2-54-ge4d704c72c-dirty/demo/testing/build/b89eabddf85eda2e51e68e8ed645dc23f2490817/build/src/cli &&
/usr/local/Cellar/cmake/3.22.0/bin/cmake -E __run_co_compile --launcher=/usr/local/bin/ccache
--tidy="/usr/local/opt/llvm@12/bin/clang-tidy;-header-filter=.;-extra-arg=-Wno-unknown-warning-option;-warnings-as-errors=*;--extra-arg-before=--driver-mode=g++"
--source=/Users/.../.conan/data/base/v1.1.2-54-ge4d704c72c-dirty/demo/testing/build/b89eabddf85eda2e51e68e8ed645dc23f2490817/repo/tests/project/src/cli/main.cpp --
"$clang"
-D_GLIBCXX_USE_CXX11_ABI=1
-I/Users/.../.conan/data/base/v1.1.2-54-ge4d704c72c-dirty/demo/testing/build/b89eabddf85eda2e51e68e8ed645dc23f2490817/repo/tests/project/src -I/Users/.../.conan/data/base/v1.1.2-54-ge4d704c72c-dirty/demo/testing/build/b89eabddf85eda2e51e68e8ed645dc23f2490817/build/src
-isystem /Users/.../.conan/data/fmt/8.0.1/_/_/package/1b37c9018fa8c082ffdce42c15ed2c2df125254e/include
-stdlib++-isystem/usr/local/opt/gcc@11/include/c++/11
-cxx-isystem/usr/local/opt/gcc@11/include/c++/11/x86_64-apple-darwin20
-L/usr/local/opt/gcc@11/lib/gcc/11 -Wno-unused-command-line-argument
-stdlib++-isystem/usr/local/opt/gcc@11/include/c++/11
-cxx-isystem/usr/local/opt/gcc@11/include/c++/11/x86_64-apple-darwin20
-L/usr/local/opt/gcc@11/lib/gcc/11 -Wno-unused-command-line-argument
-m64 -stdlib=libstdc++
-g
-arch x86_64
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk -mmacosx-version-min=12.0
-fPIE
-stdlib=libstdc++
-fcolor-diagnostics -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wnull-dereference -Wdouble-promotion -Wformat=2 -Werror -fsanitize=address
-fsanitize=undefined,bounds -fno-sanitize-recover=undefined,bounds
-std=c++20 -Winvalid-pch -Xarch_x86_64
-include/Users/.../.conan/data/base/v1.1.2-54-ge4d704c72c-dirty/demo/testing/build/b89eabddf85eda2e51e68e8ed645dc23f2490817/build/src/cli/CMakeFiles/cli.dir/cmake_pch_x86_64.hxx
-MD -MT src/cli/CMakeFiles/cli.dir/main.cpp.o
-MF CMakeFiles/cli.dir/main.cpp.o.d -o CMakeFiles/cli.dir/main.cpp.o -c /Users/.../.conan/data/base/v1.1.2-54-ge4d704c72c-dirty/demo/testing/build/b89eabddf85eda2e51e68e8ed645dc23f2490817/repo/tests/project/src/cli/main.cpp
这可以工作并编译。但是,当我在上面的调用中替换clang=/usr/local/opt/llvm@12/bin/clang++
时,我得到一个非常奇怪的编译器错误:
clang-12: error: precompiled header '/Users/.../.conan/data/base/v1.1.2-54-ge4d704c72c-dirty/demo/testing/build/b89eabddf85eda2e51e68e8ed645dc23f2490817/build/src/cli/CMakeFiles/cli.dir/cmake_pch_x86_64.hxx.pch'
was ignored because
'-include /Users/.../.conan/data/base/v1.1.2-54-ge4d704c72c-dirty/demo/testing/build/b89eabddf85eda2e51e68e8ed645dc23f2490817/build/src/cli/CMakeFiles/cli.dir/cmake_pch_x86_64.hxx'
is not first '-include' [-Werror]
这是为什么??这没有任何意义。