This addresses the issue raised here https://reviews.llvm.org/rG02bf5632a94da6c3570df002804f8d3f79c11bfc
The finish_swig_python function might be called more than once so we need to make sure that the
lldb-python-scripts target is only created once.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The target should be created for everyone calling the finish_swig_python function. Let's say (not so) hypothetically I want to create bindings for Python 2 and Python 3. I'll call finish_swig_python, twice, once for each Python version:
finish_swig_python("lldb-python" "${lldb_python_bindings_dir}" "${lldb_python_target_dir}") finish_swig_python("lldb-python2" "${lldb_python_bindings_dir}" "${lldb_python_target_dir}")
I want two corresponding targets, lldb-python-scripts and lldb-python2-scripts and two install targets. So what I proposed in D86235 is using ${swig_target}, which is the first argument to finish_swig_python to be part of the target name:
set(swig_scripts_target "${swig_target}-scripts") set(swig_scripts_install_target "install-${swig_scripts_target}")
This will create lldb-python-script and install lldb-python-script for the first call, and lldb-python2-script and install lldb-python2-script for the second call to finish_swig_python.
Sounds good, will update. In my mind it would be easier to just install all configured python scripts by specifying a single distribution component.