summaryrefslogtreecommitdiff
path: root/cmake/Modules/CompilerRTDarwinUtils.cmake
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2016-05-03 19:48:11 +0000
committerChris Bieneman <beanz@apple.com>2016-05-03 19:48:11 +0000
commit4e4d4302a346a8619da1ea3ddf2f9fdc13f572b0 (patch)
tree2215369bb14f6832b24cc6b642d8f01ceeffe8f9 /cmake/Modules/CompilerRTDarwinUtils.cmake
parente3884fe1b5d4cd3fad6aa18bca82a57a2b1be492 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268427 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/Modules/CompilerRTDarwinUtils.cmake')
-rw-r--r--cmake/Modules/CompilerRTDarwinUtils.cmake32
1 files changed, 19 insertions, 13 deletions
diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
index 5f35c6a45..328771706 100644
--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -56,14 +56,16 @@ function(darwin_test_archs os valid_archs)
endif()
set(archs ${ARGN})
- message(STATUS "Finding valid architectures for ${os}...")
- set(SIMPLE_CPP ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/src.cpp)
- file(WRITE ${SIMPLE_CPP} "#include <iostream>\nint main() { std::cout << std::endl; return 0; }\n")
-
- set(os_linker_flags)
- foreach(flag ${DARWIN_${os}_LINKFLAGS})
- set(os_linker_flags "${os_linker_flags} ${flag}")
- endforeach()
+ if(NOT TEST_COMPILE_ONLY)
+ message(STATUS "Finding valid architectures for ${os}...")
+ set(SIMPLE_CPP ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/src.cpp)
+ file(WRITE ${SIMPLE_CPP} "#include <iostream>\nint main() { std::cout << std::endl; return 0; }\n")
+
+ set(os_linker_flags)
+ foreach(flag ${DARWIN_${os}_LINKFLAGS})
+ set(os_linker_flags "${os_linker_flags} ${flag}")
+ endforeach()
+ endif()
# The simple program will build for x86_64h on the simulator because it is
# compatible with x86_64 libraries (mostly), but since x86_64h isn't actually
@@ -74,12 +76,16 @@ function(darwin_test_archs os valid_archs)
set(working_archs)
foreach(arch ${archs})
-
+
set(arch_linker_flags "-arch ${arch} ${os_linker_flags}")
- try_compile(CAN_TARGET_${os}_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_CPP}
- COMPILE_DEFINITIONS "-v -arch ${arch}" ${DARWIN_${os}_CFLAGS}
- CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${arch_linker_flags}"
- OUTPUT_VARIABLE TEST_OUTPUT)
+ if(TEST_COMPILE_ONLY)
+ try_compile_only(CAN_TARGET_${os}_${arch} -v -arch ${arch} ${DARWIN_${os}_CFLAGS})
+ else()
+ try_compile(CAN_TARGET_${os}_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_CPP}
+ COMPILE_DEFINITIONS "-v -arch ${arch}" ${DARWIN_${os}_CFLAGS}
+ CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${arch_linker_flags}"
+ OUTPUT_VARIABLE TEST_OUTPUT)
+ endif()
if(${CAN_TARGET_${os}_${arch}})
list(APPEND working_archs ${arch})
else()