Add -Wl,-color-diagnostics if a linker supports the option.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
llvm/cmake/modules/HandleLLVMOptions.cmake | ||
---|---|---|
592 ↗ | (On Diff #82311) | Why not check_cxx_compiler_flag("-Wl,-color-diagnostics" LINKER_SUPPORTS_COLOR_DIAGNOSTICS), analogous with check_c_compiler_flag below for -fno-function-sections? Would that allow us to avoid the dance with saving CMAKE_REQUIRED_FLAGS and restoring it to its old value? |
llvm/cmake/modules/HandleLLVMOptions.cmake | ||
---|---|---|
592 ↗ | (On Diff #82311) | check_c_compiler_flags doesn't seem to link the result. It just compiles. So it cannot be used for testing -Wl,-something flags. |
llvm/cmake/modules/HandleLLVMOptions.cmake | ||
---|---|---|
592 ↗ | (On Diff #82311) | To clarify, I meant using check_cxx_compiler_flag (as you're doing), but passing the flag as the first argument, rather than by setting it in CMAKE_REQUIRED_FLAGS. Are you saying that passing the flag into check_cxx_compiler_flag() does not result in linking, but setting it in CMAKE_REQUIRED_FLAGS and passing an empty string to check_cxx_compiler_flag() does? |
I had to revert to the previous version because check_cxx_compiler_flag
didn't actually work. check_cxx_compiler_flag doesn't seem to link, but
just compiles, so the previous check of -Wl,-color-diagnostics always
succeeded.
Alright, well, if the more elegant way doesn't work, let's ship the way that does work.