Page MenuHomePhabricator

[compiler-rt] Set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY when building builtins standalone
Needs ReviewPublic

Authored by mstorsjo on Thu, Nov 12, 4:14 AM.



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.

Diff Detail

Event Timeline

mstorsjo created this revision.Thu, Nov 12, 4:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptThu, Nov 12, 4:14 AM
Herald added subscribers: Restricted Project, mgorny, dberris. · View Herald Transcript
mstorsjo requested review of this revision.Thu, Nov 12, 4:14 AM