[compiler-rt] Set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY when building built...
authorMartin Storsjö <martin@martin.st>
Thu, 12 Nov 2020 09:09:38 +0000 (11:09 +0200)
committerMartin Storsjö <martin@martin.st>
Thu, 11 Mar 2021 13:21:48 +0000 (15:21 +0200)
commit8368e4d54c459fe173d76277f17c632478e91add
tree4159111522ec873490da236e99bbc51ae6cc4a38
parentbc5e9ec2dccdd18f840a09fe63c196ae25ad99d5
[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
compiler-rt/lib/builtins/CMakeLists.txt