[all-commits] [llvm/llvm-project] 8368e4: [compiler-rt] Set CMAKE_TRY_COMPILE_TARGET_TYPE to...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Thu Mar 11 05:22:34 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8368e4d54c459fe173d76277f17c632478e91add
      https://github.com/llvm/llvm-project/commit/8368e4d54c459fe173d76277f17c632478e91add
  Author: Martin Storsjö <martin at martin.st>
  Date:   2021-03-11 (Thu, 11 Mar 2021)

  Changed paths:
    M compiler-rt/lib/builtins/CMakeLists.txt

  Log Message:
  -----------
  [compiler-rt] Set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY when building builtins standalone

When building builtins, the toolchain might not yet be at a stage
when linking a test application works yet, as builtins aren't
available. Therefore set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY,
to avoid failing the compiler sanity check.

Setting CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY has the risk
of making checks for library availability succeed falsely (e.g.
indicating that libs would be available that really aren't, as the
tests don't do any linking), but the builtins library doesn't try to
link against any external libraries (and only produces static libraries
anyway), so it should be safe here.

This avoids having to set CMAKE_C_COMPILER_WORKS when bootstrapping a
cross toolchain, when building the builtins.

Differential Revision: https://reviews.llvm.org/D91334




More information about the All-commits mailing list