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.


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.
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to