<div><br><div class="gmail_quote"><div dir="auto">On Thu, Dec 7, 2017 at 3:17 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>
In <a href="https://reviews.llvm.org/D40229#947420" rel="noreferrer" target="_blank">https://reviews.llvm.org/D40229#947420</a>, @bogner wrote:<br>
<br>
> In <a href="https://reviews.llvm.org/D40229#947389" rel="noreferrer" target="_blank">https://reviews.llvm.org/D40229#947389</a>, @bogner wrote:<br>
><br>
> > I'm getting a similar problem where passing in CMAKE_CXX_COMPILER breaks my native build, except it's harder to work around because I don't specify CROSS_TOOLCHAIN_FLAGS. I'm building for a device, and specify a C++ compiler for that build, but that compiler isn't the correct one for building my native tools. When no compiler was specified on the cross-compile-native cmake invocation, this worked, but now this ends up using the wrong compiler and failing.<br>
><br>
><br>
> Actually, ignore this for now. This isn't exactly what's going wrong and I need to look at it a bit more.<br>
<br>
<br>
I'm not sure how you managed to get that to work before this change, as what then used to happen is that cmake would put the compilers into CC and CXX environment variables, and the sub-cmake would then pick those up (that is what this patch is trying to emulate with the `-D` flags). I have uploaded a patch (<a href="https://reviews.llvm.org/D40947" rel="noreferrer" target="_blank">https://reviews.llvm.org/D40947</a>) which makes these flags optional. This way, you should be able to get a more-or-less pristine setup by forcing the CROSS_TOOLCHAIN_FLAGS_NATIVE variable to an empty string.<br>
<br>
If we also go through with Don's earlier idea to leave CMAKE_C(XX)_COMPILER flags empty by default in cross-compilation scenarios (which I'm starting to like now), this should even work for you out-of-the-box.</blockquote><div dir="auto"><br></div><div dir="auto">I haven’t tried, but alternatively, we could set CC and CXX in the call.  That should give the original behavior.</div><div dir="auto"><br></div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>