aboutsummaryrefslogtreecommitdiff
path: root/llvm
diff options
context:
space:
mode:
authorArlo Siemsen <arsiem@microsoft.com>2020-07-06 13:17:22 -0700
committerShoaib Meenai <smeenai@fb.com>2020-07-06 13:27:56 -0700
commit1d8cb099231a79b6ad96e745c2d17cf307bea857 (patch)
treee9e9a9333172ebb9711987872f95be12bf5c5261 /llvm
parent60c07fd016a3a5f2050828f92257e1e5d33a485b (diff)
downloadllvm-1d8cb099231a79b6ad96e745c2d17cf307bea857.zip
llvm-1d8cb099231a79b6ad96e745c2d17cf307bea857.tar.gz
llvm-1d8cb099231a79b6ad96e745c2d17cf307bea857.tar.bz2
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
Diffstat (limited to 'llvm')
-rw-r--r--llvm/tools/llvm-shlib/CMakeLists.txt16
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt
index 25803da..f3a2056 100644
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
@@ -154,13 +154,17 @@ if(LLVM_BUILD_LLVM_C_DYLIB AND MSVC)
set(GEN_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/gen-msvc-exports.py)
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllvm-c.exports)
-
- if(CMAKE_CROSSCOMPILING)
- build_native_tool(llvm-nm llvm_nm)
- set(llvm_nm_target "${llvm_nm}")
+ if(NOT LLVM_NM)
+ if(CMAKE_CROSSCOMPILING)
+ build_native_tool(llvm-nm llvm_nm)
+ set(llvm_nm_target "${llvm_nm}")
+ else()
+ set(llvm_nm $<TARGET_FILE:llvm-nm>)
+ set(llvm_nm_target llvm-nm)
+ endif()
else()
- set(llvm_nm $<TARGET_FILE:llvm-nm>)
- set(llvm_nm_target llvm-nm)
+ set(llvm_nm ${LLVM_NM})
+ set(llvm_nm_target "")
endif()
add_custom_command(OUTPUT ${LLVM_EXPORTED_SYMBOL_FILE}