[PATCH] D23823: [builtins] Make sure builtin compile tests respect CMAKE_C_COMPILER_TARGET

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 10:13:07 PDT 2016


fjricci updated this revision to Diff 69134.
fjricci added a comment.

Update cmake style and check compiler ID


https://reviews.llvm.org/D23823

Files:
  cmake/Modules/BuiltinTests.cmake

Index: cmake/Modules/BuiltinTests.cmake
===================================================================
--- cmake/Modules/BuiltinTests.cmake
+++ cmake/Modules/BuiltinTests.cmake
@@ -11,7 +11,13 @@
   file(WRITE ${SIMPLE_C} "${ARG_SOURCE}\n")
   string(REGEX MATCHALL "<[A-Za-z0-9_]*>" substitutions
          ${CMAKE_C_COMPILE_OBJECT})
-  string(REPLACE ";" " " extra_flags "${ARG_FLAGS}")
+
+  set(TRY_COMPILE_FLAGS "${ARG_FLAGS}")
+  if(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_TARGET)
+    list(APPEND TRY_COMPILE_FLAGS -target;${CMAKE_C_COMPILER_TARGET})
+  endif()
+
+  string(REPLACE ";" " " extra_flags "${TRY_COMPILE_FLAGS}")
 
   set(test_compile_command "${CMAKE_C_COMPILE_OBJECT}")
   foreach(substitution ${substitutions})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23823.69134.patch
Type: text/x-patch
Size: 753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160824/78368409/attachment.bin>


More information about the llvm-commits mailing list