<div><div dir="auto">Would handling them like the linker flags and only passing them when not cross compiling fix this?</div><br><div class="gmail_quote"><div>On Wed, Dec 6, 2017 at 3:34 AM Pavel Labath via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">labath added a comment.<br>
<br>
I think this breaks any non-trivial cross-compilation scenario.<br>
<br>
When compiling for android, we compile the android binaries with the compiler in the android ndk (so `CMAKE_C**_COMPILER` points to the android ndk). However, this compiler is not capable of compiling any host binaries. So the way we make this work is by setting the host compilers via `-DCROSS_TOOLCHAIN_FLAGS_NATIVE`. This worked because command line has precedence over the compiler specified by the environment variables. However, this now appends `-DCMAKE_C**_COMPILER`, which will override whatever compiler we have specified via cross toolchain flags.<br>
<br>
I am not sure we ever want to be specifying the native compiler, as this is likely to be different in any non-trivial cross-compilation scenario, but if we're going to do that, could we at least put `CROSS_TOOLCHAIN_FLAGS` last so that this can be overridden by the user who needs it?<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D40229" rel="noreferrer" target="_blank">https://reviews.llvm.org/D40229</a><br>
<br>
<br>
<br>
</blockquote></div></div>