[Lldb-commits] [lldb] [lldb][rpc] Fix build failures when building lldb-rpc-gen (PR #151603)

Martin Storsjö via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 1 01:21:19 PDT 2025


================
@@ -18,6 +18,11 @@ add_lldb_tool(lldb-rpc-gen
       Support
   )
 
-if (NOT DEFINED LLDB_RPC_GEN_EXE)
-  set(LLDB_RPC_GEN_EXE $<TARGET_FILE:lldb-rpc-gen> CACHE STRING "Executable that generates lldb-rpc-server")
+if (CMAKE_CROSSCOMPILING)
+  setup_host_tool(lldb-rpc-gen LLDB_RPC_GEN_EXE lldb_rpc_gen_exe lldb_rpc_gen_target)
+else()
+  if (NOT DEFINED LLDB_RPC_GEN_EXE)
+    set(LLDB_RPC_GEN_EXE $<TARGET_FILE:lldb-rpc-gen> CACHE STRING "Executable that generates lldb-rpc-server")
----------------
mstorsjo wrote:

When you unconditionally adopt `setup_host_tool`, you can also get rid of this manual variable for pointing to a prebuilt `lldb-rpc-gen` binary; the `setup_host_tool` (which internally calls `get_host_tool_path`) machinery automatically configures a similar cmake variable to let you manually override the path to the binary, and it also checks in the directory `LLVM_NATIVE_TOOL_DIR` if you happen to have a preexisting binary there, and then based on that decide to either compile a new one or use the existing one.

https://github.com/llvm/llvm-project/pull/151603


More information about the lldb-commits mailing list