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

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 11:55:32 PDT 2016


beanz added a comment.

`CMAKE_C_COMPILER_TARGET` is an oddly used option. CMake only uses it in two places, one is in the tests, and the other is in the logic for finding the compiler. Setting `CMAKE_C_COMPILER_TARGET` and not explicitly overriding your compiler to clang, could result in undesirable behavior on systems that have GCC cross-compilers installed, so I'm a little concerned about using this option. It might make more sense to use `COMPILER_RT_DEFAULT_TARGET_TRIPLE` instead.


================
Comment at: cmake/Modules/BuiltinTests.cmake:17
@@ +16,3 @@
+  if(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_TARGET)
+    list(APPEND TRY_COMPILE_FLAGS -target;${CMAKE_C_COMPILER_TARGET})
+  endif()
----------------
`list(APPEND...)` is better, but don't put a semi-colon between the elements, a space will suffice. Using a semi-colon is odd because instead of appending a list to a list you're appending a string-ified list.


https://reviews.llvm.org/D23823





More information about the llvm-commits mailing list