Skip to content

Commit e10146d

Browse files
committed
Add option LLVM_NM to allow specifying the location of the llvm-nm tool
The new option works like the existing LLVM_TABLEGEN, and LLVM_CONFIG_PATH options. Instead of building llvm-nm, the build uses the executable defined by LLVM_NM. This is useful for cross-compilation scenarios where the host cannot run the cross-compiled tool, and recursing into another cmake build is not an option (due to required DEFINE's, for example). Reviewed By: smeenai Differential Revision: https://reviews.llvm.org/D83022
1 parent 6c040dd commit e10146d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

llvm/tools/llvm-shlib/CMakeLists.txt

+10-6
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,17 @@ if(MSVC)
154154
set(GEN_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/gen-msvc-exports.py)
155155

156156
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllvm-c.exports)
157-
158-
if(CMAKE_CROSSCOMPILING)
159-
build_native_tool(llvm-nm llvm_nm)
160-
set(llvm_nm_target "${llvm_nm}")
157+
if(NOT LLVM_NM)
158+
if(CMAKE_CROSSCOMPILING)
159+
build_native_tool(llvm-nm llvm_nm)
160+
set(llvm_nm_target "${llvm_nm}")
161+
else()
162+
set(llvm_nm $<TARGET_FILE:llvm-nm>)
163+
set(llvm_nm_target llvm-nm)
164+
endif()
161165
else()
162-
set(llvm_nm $<TARGET_FILE:llvm-nm>)
163-
set(llvm_nm_target llvm-nm)
166+
set(llvm_nm ${LLVM_NM})
167+
set(llvm_nm_target "")
164168
endif()
165169

166170
add_custom_command(OUTPUT ${LLVM_EXPORTED_SYMBOL_FILE}

0 commit comments

Comments
 (0)