[CMake] NFC. Add support for testing the compiler without testing the linker

Summary:
One of the big limitations we have in the compiler-rt build system today is that we cannot bootstrap building the builtins because you need a fully functional toolchain to pass CMake's tests.

This change adds support for compile only tests.

It is NFC because nothing is using the compile-only tests yet.

I believe this is the last separable part of D16653.

Reviewers: samsonov

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D19692

llvm-svn: 268427
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index 4d16ca7..b4a2b48 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -114,6 +114,8 @@
   check_compile_definition("${def}" "${argstring}" HAS_${arch}_DEF)
   if(NOT HAS_${arch}_DEF)
     set(CAN_TARGET_${arch} FALSE)
+  elseif(TEST_COMPILE_ONLY)
+    try_compile_only(CAN_TARGET_${arch} ${TARGET_${arch}_CFLAGS})
   else()
     set(argstring "${CMAKE_EXE_LINKER_FLAGS} ${argstring}")
     try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE}