[Lldb-commits] [lldb] b5a927b - [lldb] Move create_relative_symlink function up in CMake hierarchy
Dimitry Andric via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 23 13:00:04 PST 2021
Author: Dimitry Andric
Date: 2021-11-23T21:59:49+01:00
New Revision: b5a927b972b2c07b4597e93ed0b57803bfc0e6ae
URL: https://github.com/llvm/llvm-project/commit/b5a927b972b2c07b4597e93ed0b57803bfc0e6ae
DIFF: https://github.com/llvm/llvm-project/commit/b5a927b972b2c07b4597e93ed0b57803bfc0e6ae.diff
LOG: [lldb] Move create_relative_symlink function up in CMake hierarchy
Configuring lldb with `LLDB_ENABLE_PYTHON=OFF` and `LLDB_ENABLE_LUA=ON` results in a CMake error:
CMake Error at lldb/bindings/lua/CMakeLists.txt:47 (create_relative_symlink):
Unknown CMake command "create_relative_symlink".
Call Stack (most recent call first):
lldb/CMakeLists.txt:117 (finish_swig_lua)
This is because the CMake function `create_relative_symlink` only exists in `lldb/bindings/python/CMakeLists.txt`, and not in `lldb/bindings/lua/CMakeLists.txt`.
Move the function to `lldb/bindings/CMakeLists.txt`, so it is available for all language bindings.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D114465
Added:
Modified:
lldb/bindings/CMakeLists.txt
lldb/bindings/python/CMakeLists.txt
Removed:
################################################################################
diff --git a/lldb/bindings/CMakeLists.txt b/lldb/bindings/CMakeLists.txt
index 9759b069fdc45..c8aa0bcf96817 100644
--- a/lldb/bindings/CMakeLists.txt
+++ b/lldb/bindings/CMakeLists.txt
@@ -31,6 +31,20 @@ set(SWIG_COMMON_FLAGS
${DARWIN_EXTRAS}
)
+function(create_relative_symlink swig_target dest_file output_dir output_name)
+ get_filename_component(dest_file ${dest_file} ABSOLUTE)
+ get_filename_component(output_dir ${output_dir} ABSOLUTE)
+ file(RELATIVE_PATH rel_dest_file ${output_dir} ${dest_file})
+ if(CMAKE_HOST_UNIX)
+ set(LLVM_LINK_OR_COPY create_symlink)
+ else()
+ set(LLVM_LINK_OR_COPY copy)
+ endif()
+ add_custom_command(TARGET ${swig_target} POST_BUILD VERBATIM
+ COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} ${rel_dest_file} ${output_name}
+ WORKING_DIRECTORY ${output_dir})
+endfunction()
+
if (LLDB_ENABLE_PYTHON)
add_subdirectory(python)
endif()
diff --git a/lldb/bindings/python/CMakeLists.txt b/lldb/bindings/python/CMakeLists.txt
index 1f7ed18a2a0cb..cecf1e0fc095f 100644
--- a/lldb/bindings/python/CMakeLists.txt
+++ b/lldb/bindings/python/CMakeLists.txt
@@ -52,20 +52,6 @@ function(create_python_package swig_target working_dir pkg_dir)
WORKING_DIRECTORY ${working_dir})
endfunction()
-function(create_relative_symlink swig_target dest_file output_dir output_name)
- get_filename_component(dest_file ${dest_file} ABSOLUTE)
- get_filename_component(output_dir ${output_dir} ABSOLUTE)
- file(RELATIVE_PATH rel_dest_file ${output_dir} ${dest_file})
- if(CMAKE_HOST_UNIX)
- set(LLVM_LINK_OR_COPY create_symlink)
- else()
- set(LLVM_LINK_OR_COPY copy)
- endif()
- add_custom_command(TARGET ${swig_target} POST_BUILD VERBATIM
- COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} ${rel_dest_file} ${output_name}
- WORKING_DIRECTORY ${output_dir})
-endfunction()
-
function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_target_dir)
# Add a Post-Build Event to copy over Python files and create the symlink to
# liblldb.so for the Python API(hardlink on Windows).
More information about the lldb-commits
mailing list