llvm-project/cmake/Modules
John Ericson 7017e6c9cf [cmake] Partially deduplicate `{llvm,compiler_rt}_check_linker_flag` for runtime libs and llvm
We previously had a few varied definitions of this floating around.

I had tried to make the one installed with LLVM handle all the cases, and then made the others use it, but this ran into issues with `HandleOutOfTreeLLVM` not working for compiler-rt, and also `CMAKE_EXE_LINKER_FLAGS` not working right without `CMP0056` set to the new behavior.

 My compromise solution is this:

 - No not completely deduplicate: the runtime libs will instead use a version that still exists as part of the internal and not installed common shared CMake utilities. This avoids `HandleOutOfTreeLLVM` or a workaround for compiler-rt.

- Continue to use `CMAKE_REQUIRED_FLAGS`, which effects compilation and linking. Maybe this is unnecessary, but it's safer to leave that as a future change. Also means we can avoid `CMP0056` for now, to try out later, which is good incrementality too.

- Call it `llvm_check_compiler_linker_flag` since it, in fact is about both per its implementation (before and after this patch), so there is no name collision.

In the future, we might still enable CMP0056 and make compiler-rt work with HandleOutOfTreeLLVM, which case we delete `llvm_check_compiler_flag` and go back to the old way (as these are, in fact, linking related flags), but that I leave for someone else as future work.

The original issue was reported to me in https://reviews.llvm.org/D116521#3248117 as
D116521 made clang and LLVM use the common cmake utils.

Reviewed By: sebastian-ne, phosek, #libunwind, #libc, #libc_abi, ldionne

Differential Revision: https://reviews.llvm.org/D117537
2022-01-29 06:07:24 +00:00
..
EnableLanguageNolink.cmake [libunwind] Try to add --unwindlib=none while configuring and building libunwind 2021-11-05 10:10:19 +02:00
ExtendPath.cmake [cmake] Tweak warning in `extend_path` helper function 2021-12-30 07:00:50 +00:00
FindPrefixFromConfig.cmake [CMake] Factor out config prefix finding logic 2022-01-07 20:16:18 +00:00
HandleCompilerRT.cmake [CMake] Cache the compiler-rt library search results 2021-10-27 17:53:03 -07:00
HandleOutOfTreeLLVM.cmake [cmake] Move HandleOutOfTreeLLVM to common cmake utils 2022-01-19 22:05:23 +00:00
LLVMCheckCompilerLinkerFlag.cmake [cmake] Partially deduplicate `{llvm,compiler_rt}_check_linker_flag` for runtime libs and llvm 2022-01-29 06:07:24 +00:00
SetPlatformToolchainTools.cmake [CMake] Move the AIX archiver settings to a module 2022-01-05 11:46:30 -08:00