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

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 17:51:32 PDT 2016


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

Improved cmake syntax


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_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.69063.patch
Type: text/x-patch
Size: 717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160824/368d8e77/attachment.bin>


More information about the llvm-commits mailing list