From 7ddd5998e5e5f628bd8b34aa464194c9d59530bd Mon Sep 17 00:00:00 2001 From: Jonas Hahnfeld Date: Wed, 21 Sep 2016 05:44:06 +0000 Subject: [CMake] Rename back SIMPLE_SOURCE to compile as C++ This was changed in rL276151 and causes problems if the C++ compiler does not support the same arches as the C compiler. For the builtins, only the C compiler is tested in try_compile_only. Additionally, -fno-exceptions is passed in (if available) to work around the case where no libunwind is available. Differential Revision: https://reviews.llvm.org/D23654 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282054 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/Modules/CompilerRTUtils.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmake/Modules/CompilerRTUtils.cmake') diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake index ba2a7bcfc..3fa50c8ad 100644 --- a/cmake/Modules/CompilerRTUtils.cmake +++ b/cmake/Modules/CompilerRTUtils.cmake @@ -132,8 +132,12 @@ macro(test_target_arch arch def) try_compile_only(CAN_TARGET_${arch} ${TARGET_${arch}_CFLAGS}) else() set(argstring "${CMAKE_EXE_LINKER_FLAGS} ${argstring}") + set(FLAG_NO_EXCEPTIONS "") + if(COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG) + set(FLAG_NO_EXCEPTIONS " -fno-exceptions ") + endif() try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE} - COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS}" + COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS} ${FLAG_NO_EXCEPTIONS}" OUTPUT_VARIABLE TARGET_${arch}_OUTPUT CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${argstring}") endif() -- cgit v1.2.3