This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Fix broken uses of `try_compile_only()` and improve the function.
ClosedPublic

Authored by delcypher on Mar 15 2019, 12:45 PM.

Details

Summary

There were existing calls to try_compile_only() with arguments not
prefixed by SOURCE or FLAGS. These were silently being ignored.
It looks like the SOURCE and FLAGS arguments were first introduced
in r278454.

One implication of this is that for a builtins only build for Darwin
(see darwin_test_archs()) it would mean we weren't actually passing
-arch <arch> to the compiler). This would result in compiler-rt
claiming all supplied architectures could be targetted provided
the compiler could build for Clang's default architecture.

This patch fixes this in several ways.

  • Fixes all incorrect calls to try_compile_only().
  • Adds code to try_compile_only() to check for unhandled arguments and raises a fatal error if this occurs. This should stop any incorrect calls in the future.
  • Improve the documentation on try_compile_only() which seemed completely wrong.

rdar://problem/48928526

Diff Detail

Event Timeline

delcypher created this revision.Mar 15 2019, 12:45 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 15 2019, 12:45 PM
Herald added subscribers: Restricted Project, jdoerfert, mgorny. · View Herald Transcript

Fix missing unused arguments checks.

kubamracek accepted this revision.Mar 15 2019, 1:11 PM
This revision is now accepted and ready to land.Mar 15 2019, 1:11 PM
This revision was automatically updated to reflect the committed changes.