diff options
Diffstat (limited to 'compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake')
| -rw-r--r-- | compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake index 5f35c6a4520..32877170631 100644 --- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake +++ b/compiler-rt/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() |

