[clang] [compiler-rt] [libcxx] [libunwind] [llvm] [openmp] [cmake] switch to CMake's native `check_{compiler,linker}_flag` (PR #96171)
Ryan Prichard via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 24 17:26:52 PDT 2024
rprichard wrote:
This check in libcxx/cmake/config-ix.cmake seems to break:
```
check_cxx_compiler_flag(-nostdlib++ CXX_SUPPORTS_NOSTDLIBXX_FLAG)
```
It appears that it isn't passing either `-nostdlib++` or `-lc++` to the clang linker command-line, but then `-lc++` _is_ passed to `ld.lld` because `-nostdlib++` is missing. The check fails because libc++ hasn't been built yet.
It seems that the older function had been dealing with this:
```
-function(llvm_check_compiler_linker_flag lang flag out_var)
- # If testing a flag with check_c_compiler_flag, it gets added to the compile
- # command only, but not to the linker command in that test. If the flag
- # is vital for linking to succeed, the test would fail even if it would
- # have succeeded if it was included on both commands.
- #
- # Therefore, try adding the flag to CMAKE_REQUIRED_FLAGS, which gets
- # added to both compiling and linking commands in the tests.
...
```
It sounds like the right fix is to use `check_linker_flag` though? I can test that...
https://github.com/llvm/llvm-project/pull/96171
More information about the llvm-commits
mailing list