[PATCH] D146666: [CMake] Respect variables for specifying host tools even without LLVM_USE_HOST_TOOLS set

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 01:35:39 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG4a5bc791f38a: [CMake] Respect variables for specifying host tools even without… (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146666/new/

https://reviews.llvm.org/D146666

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -2418,7 +2418,7 @@
 function(setup_host_tool tool_name setting_name exe_var_name target_var_name)
   set(${setting_name}_DEFAULT "${tool_name}")
 
-  if(LLVM_USE_HOST_TOOLS AND LLVM_NATIVE_TOOL_DIR)
+  if(LLVM_NATIVE_TOOL_DIR)
     if(EXISTS "${LLVM_NATIVE_TOOL_DIR}/${tool_name}${LLVM_HOST_EXECUTABLE_SUFFIX}")
       set(${setting_name}_DEFAULT "${LLVM_NATIVE_TOOL_DIR}/${tool_name}${LLVM_HOST_EXECUTABLE_SUFFIX}")
     endif()
@@ -2427,14 +2427,12 @@
   set(${setting_name} "${${setting_name}_DEFAULT}" CACHE
     STRING "Host ${tool_name} executable. Saves building if cross-compiling.")
 
-  if(LLVM_USE_HOST_TOOLS)
-    if(NOT ${setting_name} STREQUAL "${tool_name}")
-      set(exe_name ${${setting_name}})
-      set(target_name ${${setting_name}})
-    else()
-      build_native_tool(${tool_name} exe_name DEPENDS ${tool_name})
-      set(target_name ${exe_name})
-    endif()
+  if(NOT ${setting_name} STREQUAL "${tool_name}")
+    set(exe_name ${${setting_name}})
+    set(target_name ${${setting_name}})
+  elseif(LLVM_USE_HOST_TOOLS)
+    build_native_tool(${tool_name} exe_name DEPENDS ${tool_name})
+    set(target_name ${exe_name})
   else()
     set(exe_name $<TARGET_FILE:${tool_name}>)
     set(target_name ${tool_name})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146666.507993.patch
Type: text/x-patch
Size: 1426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230324/ef434ea1/attachment.bin>


More information about the llvm-commits mailing list