[CMake] Fix broken uses of try_compile_only() and improve the function.
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
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.
Reviewers: beanz, fjricci, dsanders, kubamracek, yln, dcoughlin
Subscribers: mgorny, jdoerfert, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D59429