[PATCH] D24156: [CMake] Explicitly add --target option to compiler flags

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 07:50:36 PDT 2016


fjricci added a comment.

It looks like this change won't break any of the targets I use. However, I still need to manually set `CMAKE_C_COMPILER_TARGET` or add `--target` to `CMAKE_C_FLAGS` for some targets, which I think somewhat defeats the purpose of this patch.

The problem is that the initial cmake compiler test will fail when cross-compiling, because it will attempt to compile and link for the default architecture instead of the architecture specified by `COMPILER_RT_DEFAULT_TARGET_TRIPLE`. This will fail, for example, when the sysroot and system libs are built for the target architecture, which is different from the default architecture that the compiler is targeting. It will also fail if there are architecture-specific flags in `CMAKE_C_FLAGS`.

So, I don't mind this change being merged, as it won't break anything, as far as I can tell, but I don't think it will fully solve the problems you're trying to solve by using it.


https://reviews.llvm.org/D24156





More information about the llvm-commits mailing list