<div dir="ltr">Thanks for fixing this -- I wasn't aware of <span style="font-size:12.8px">$<SEMICOLON>.</span></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 11, 2017 at 11:53 AM, Justin Bogner via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: bogner<br>
Date: Mon Dec 11 11:53:23 2017<br>
New Revision: 320413<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=320413&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=320413&view=rev</a><br>
Log:<br>
[cmake] Pass TARGETS_TO_BUILD through to host tools build<br>
<br>
In r319620, the host build was changed to use Native for<br>
TARGETS_TO_BUILD because passing semicolons through add_custom_command<br>
is surprisingly difficult. However, Native really doesn't make any<br>
sense here, and it only works because we don't technically do any<br>
codegen in the host tools so pretty well anything will "work".<br>
<br>
The problem here is that passing something other than the correct<br>
value is very fragile - as evidence note how the llvm-config in the<br>
host tools acts differently than the target one now, and misreports<br>
the targets to build. Similarly, if there is any logic conditional on<br>
the targets in tablegen (now or in the future), it will do the wrong<br>
thing.<br>
<br>
To fix this, we need to escape the semicolons in the targets string<br>
and pass it through to the child cmake invocation.<br>
<br>
Modified:<br>
    llvm/trunk/cmake/modules/<wbr>CrossCompile.cmake<br>
<br>
Modified: llvm/trunk/cmake/modules/<wbr>CrossCompile.cmake<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CrossCompile.cmake?rev=320413&r1=320412&r2=320413&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/cmake/<wbr>modules/CrossCompile.cmake?<wbr>rev=320413&r1=320412&r2=<wbr>320413&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/cmake/modules/<wbr>CrossCompile.cmake (original)<br>
+++ llvm/trunk/cmake/modules/<wbr>CrossCompile.cmake Mon Dec 11 11:53:23 2017<br>
@@ -36,11 +36,16 @@ function(llvm_create_cross_<wbr>target_intern<br>
   add_custom_target(CREATE_LLVM_<wbr>${target_name}<br>
                     DEPENDS ${LLVM_${target_name}_BUILD})<br>
<br>
+  # Escape semicolons in the targets list so that cmake doesn't expand<br>
+  # them to spaces.<br>
+  string(REPLACE ";" "$<SEMICOLON>" targets_to_build_arg<br>
+         "${LLVM_TARGETS_TO_BUILD}")<br>
+<br>
   add_custom_command(OUTPUT ${LLVM_${target_name}_BUILD}/<wbr>CMakeCache.txt<br>
     COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"<br>
         ${CROSS_TOOLCHAIN_FLAGS_${<wbr>target_name}} ${CMAKE_SOURCE_DIR}<br>
         -DLLVM_TARGET_IS_CROSSCOMPILE_<wbr>HOST=TRUE<br>
-        -DLLVM_TARGETS_TO_BUILD=Native<br>
+        -DLLVM_TARGETS_TO_BUILD="${<wbr>targets_to_build_arg}"<br>
         ${build_type_flags} ${linker_flag} ${external_clang_dir}<br>
     WORKING_DIRECTORY ${LLVM_${target_name}_BUILD}<br>
     DEPENDS CREATE_LLVM_${target_name}<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>