[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 15:40:57 PDT 2016


fjricci added a comment.

In order for cmake to check whether Clang can cross-compile for a given target, `-target <target>` needs to be set. One could do this either by explicitly adding it to `CMAKE_<LANG>_FLAGS` or by setting `CMAKE_<LANG>_COMPILER_TARGET`. The problem with using `COMPILER_RT_DEFAULT_TARGET_TRIPLE` is that this won't set `-target`.

A further complication is that `COMPILER_RT_DEFAULT_TARGET_TRIPLE` and the desired `-target` option aren't always the same. For example, to build for linux-armhf, `COMPILER_RT_DEFAULT_TARGET_TRIPLE` expects `armhf-linux-gnueabihf`, but you need to build with `-target armv7-linux-gnueabihf`, so there isn't a 1:1 mapping.

Presumably this could be fixed by reworking `COMPILER_RT_DEFAULT_TARGET_TRIPLE`, but that's more involved, and this seemed like a simpler solution.


https://reviews.llvm.org/D23823





More information about the llvm-commits mailing list