[compiler-rt] r279747 - [builtins] Make sure builtin compile tests respect CMAKE_C_COMPILER_TARGET

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 09:15:45 PDT 2016


Author: fjricci
Date: Thu Aug 25 11:15:45 2016
New Revision: 279747

URL: http://llvm.org/viewvc/llvm-project?rev=279747&view=rev
Log:
[builtins] Make sure builtin compile tests respect CMAKE_C_COMPILER_TARGET

Summary:
Since we generate the compiler invocation on our own, we need to
manually add -target if CMAKE_C_COMPILER_TARGET has been specified.

Reviewers: compnerd, beanz

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D23823

Modified:
    compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake

Modified: compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake?rev=279747&r1=279746&r2=279747&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/BuiltinTests.cmake Thu Aug 25 11:15:45 2016
@@ -11,7 +11,13 @@ function(try_compile_only output)
   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})




More information about the llvm-commits mailing list