From 446483ac09a5d94b851e069f870122bd50d2f9c3 Mon Sep 17 00:00:00 2001 From: Jonas Hahnfeld Date: Sun, 17 Jun 2018 09:51:33 +0000 Subject: Revert "[CMake] Use a different source depending on C++ support" This reverts commit r332924 and followup r332936 silencing a warning. The change breaks the build on x86 if there is no 32-bit version of the C++ libraries, see discussion in https://reviews.llvm.org/D47169. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334903 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/Modules/CompilerRTUtils.cmake | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'cmake/Modules/CompilerRTUtils.cmake') diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake index ee1644ba6..f567202fa 100644 --- a/cmake/Modules/CompilerRTUtils.cmake +++ b/cmake/Modules/CompilerRTUtils.cmake @@ -125,19 +125,6 @@ endfunction() # 2) simple file can be successfully built. # If successful, saves target flags for this architecture. macro(test_target_arch arch def) - string(RANDOM TARGET_${arch}_NAME) - set(TARGET_${arch}_NAME "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cmTC_${TARGET_${arch}_NAME}.dir") - file(MAKE_DIRECTORY ${TARGET_${arch}_NAME}) - if(SANITIZER_CXX_ABI_INTREE) - # We're using in tree C++ ABI, only test the C compiler for now. - set(TARGET_${arch}_FILENAME "${TARGET_${arch}_NAME}/CheckTarget.c") - file(WRITE "${TARGET_${arch}_FILENAME}" "#include \nint main() { (void)malloc(sizeof(int)); return 0; }\n") - else() - # We're using the system C++ ABI, test that we can build C++ programs. - set(TARGET_${arch}_FILENAME "${TARGET_${arch}_NAME}/CheckTarget.cpp") - file(WRITE "${TARGET_${arch}_FILENAME}" "#include \nint main() { (void) new int; return 0; }\n") - endif() - set(TARGET_${arch}_CFLAGS ${ARGN}) set(TARGET_${arch}_LINK_FLAGS ${ARGN}) set(argstring "") @@ -157,7 +144,7 @@ macro(test_target_arch arch def) endif() set(SAVED_CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${argstring}") - try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${TARGET_${arch}_FILENAME} + try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE} COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS} ${FLAG_NO_EXCEPTIONS}" OUTPUT_VARIABLE TARGET_${arch}_OUTPUT) set(CMAKE_EXE_LINKER_FLAGS ${SAVED_CMAKE_EXE_LINKER_FLAGS}) @@ -170,8 +157,6 @@ macro(test_target_arch arch def) # Bail out if we cannot target the architecture we plan to test. message(FATAL_ERROR "Cannot compile for ${arch}:\n${TARGET_${arch}_OUTPUT}") endif() - - file(REMOVE_RECURSE ${TARGET_${arch}_NAME}) endmacro() macro(detect_target_arch) -- cgit v1.2.3