[Lldb-commits] [PATCH] D86402: Avoid creating lldb-python-scripts target more than once

António Afonso via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Aug 22 10:27:19 PDT 2020


aadsm created this revision.
aadsm added a reviewer: JDevlieghere.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.
aadsm requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86402

Files:
  lldb/bindings/python/CMakeLists.txt


Index: lldb/bindings/python/CMakeLists.txt
===================================================================
--- lldb/bindings/python/CMakeLists.txt
+++ lldb/bindings/python/CMakeLists.txt
@@ -165,16 +165,19 @@
   endif()
   set(python_scripts_target "lldb-python-scripts")
   set(python_scripts_install_target "install-${python_scripts_target}")
-  add_custom_target(${python_scripts_target})
+  # This function might be called multiple times but we only need to create the custom target once.
+  if (NOT TARGET ${python_scripts_target})
+    add_custom_target(${python_scripts_target})
+    if (NOT LLVM_ENABLE_IDE)
+      add_llvm_install_targets(${python_scripts_install_target}
+                              COMPONENT ${python_scripts_target}
+                              DEPENDS ${python_scripts_target})
+    endif()
+  endif()
   add_dependencies(${python_scripts_target} ${swig_target})
   install(DIRECTORY ${lldb_python_target_dir}/../
           DESTINATION ${LLDB_PYTHON_INSTALL_PATH}
           COMPONENT ${python_scripts_target})
-  if (NOT LLVM_ENABLE_IDE)
-    add_llvm_install_targets(${python_scripts_install_target}
-                             COMPONENT ${python_scripts_target}
-                             DEPENDS ${python_scripts_target})
-  endif()
 
   # Add a Post-Build Event to copy the custom Python DLL to the lldb binaries dir so that Windows can find it when launching
   # lldb.exe or any other executables that were linked with liblldb.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86402.287205.patch
Type: text/x-patch
Size: 1479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200822/029f0ec1/attachment-0001.bin>


More information about the lldb-commits mailing list