[clang] [llvm] [cmake] Remove custom linker flag check function (PR #86602)

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 21 02:01:27 PDT 2024


petrhosek wrote:

I'd actually prefer this not be merged as is. I have already made a similar change locally but during testing I discovered a major issue with `check_linker_flag`: unlike other CMake `check_*` functions, and even `llvm_check_linker_flag`, `check_linker_flag` doesn't apply `CMAKE_REQUIRED_LINK_OPTIONS` because [the implementation overrides it](https://gitlab.kitware.com/cmake/cmake/-/blob/14de6802e40edcdeebc73d81210fe8e1ec0f469e/Modules/Internal/CheckLinkerFlag.cmake#L25) and this can result in failed checks when `CMAKE_REQUIRED_LINK_OPTIONS` contains necessary flags (it actually breaks the runtimes build which this change doesn't touch). I'd rather prefer to continue using `llvm_check_linker_flag` with our own implementation [similar to the CMake one](https://gitlab.kitware.com/cmake/cmake/-/blob/14de6802e40edcdeebc73d81210fe8e1ec0f469e/Modules/Internal/CheckLinkerFlag.cmake) that appends `CMAKE_REQUIRED_LINK_OPTIONS` rather than overwriting it. If you want to implement such a change, that would be great, otherwise I can take a stab at it when I have some time.

https://github.com/llvm/llvm-project/pull/86602


More information about the llvm-commits mailing list