[PATCH] D143052: [CMake] Replace llvm_check_linker_flag and llvm_check_compiler_linker_flag

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 4 20:05:34 PDT 2023


phosek added a comment.

In D143052#4468485 <https://reviews.llvm.org/D143052#4468485>, @ldionne wrote:

> What is the status of this? We now require CMake 3.20, can this be rebased and landed in some form?

The issue I ran into is that `check_linker_flag` annoyingly behaves differently from `check_{c,cxx}_compiler_flag`.

- With `check_{c,cxx}_compiler_flag`, CMake //appends// `CMAKE_REQUIRED_FLAGS` to the `flag` before invoking `try_compile`.
- With `check_linker_flag`, CMake //replaces// the content of `CMAKE_REQUIRED_LINK_OPTIONS` with the `flag`.

This somewhat reduces the utility of `check_linker_flag` and also means it behaves differently from `llvm_check_compiler_linker_flag` which is based on  `check_{c,cxx}_compiler_flag`.

What I'm considering now is keeping `llvm_check_linker_flag`, but changing its implementation to be based on `check_linker_flag` while preserving `CMAKE_REQUIRED_LINK_OPTIONS`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143052/new/

https://reviews.llvm.org/D143052



More information about the cfe-commits mailing list