check_linker_flags currently sets the *compiler* flags (via
CMAKE_REQUIRED_FLAGS), and thus implicitly relies on cmake's default
behavior of passing the compiler flags to the linker. This breaks when
cmake's build rules have been altered to not pollute the link line with
compiler flags (which can be desirable for build cleanliness). Instead,
set CMAKE_EXE_LINKER_FLAGS explicitly and use CMP0056 to ensure the
linker flags are passed along. Additionally, since we're inside a
function, we can just alter the variable directly (as the alteration
will be limited to the scope of the function) rather than saving and
restoring the old value.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
LG if none of the subtree projects are negatively impacted by this.
CMakeLists.txt | ||
---|---|---|
20 ↗ | (On Diff #120884) | Since this impacts all try_compile, can you ensure that libc++ in tree builds are not impacted by this change? |
CMakeLists.txt | ||
---|---|---|
20 ↗ | (On Diff #120884) | I confirmed that clang, LLD and libc++ all build correctly after this change. |