[PATCH] D23654: [CMake] Rename back SIMPLE_SOURCE to compile as C++

Jonas Hahnfeld via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 00:17:49 PDT 2016


Hahnfeld updated the summary for this revision.
Hahnfeld updated this revision to Diff 71901.
Hahnfeld added a comment.
Herald added subscribers: mgorny, beanz.

Pass in `-fno-exceptions` if available


https://reviews.llvm.org/D23654

Files:
  cmake/Modules/CompilerRTUtils.cmake
  cmake/config-ix.cmake

Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -92,7 +92,7 @@
 # platform. We use the results of these tests to build only the various target
 # runtime libraries supported by our current compilers cross-compiling
 # abilities.
-set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.c)
+set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.cc)
 file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <stdio.h>\nint main() { printf(\"hello, world\"); }\n")
 
 # Add $arch as supported with no additional flags.
Index: cmake/Modules/CompilerRTUtils.cmake
===================================================================
--- cmake/Modules/CompilerRTUtils.cmake
+++ cmake/Modules/CompilerRTUtils.cmake
@@ -132,8 +132,12 @@
       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()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23654.71901.patch
Type: text/x-patch
Size: 1533 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160920/12afc655/attachment.bin>


More information about the llvm-commits mailing list