[lldb] Copy the system debugserver in LLDB.framework
authorJonas Devlieghere <jonas@devlieghere.com>
Fri, 24 Sep 2021 21:59:58 +0000 (14:59 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Fri, 24 Sep 2021 22:07:22 +0000 (15:07 -0700)
When using the system debugserver for testing, copy the binary in the
LLDB.framework Resource directory instead of the build's bin directory.

rdar://82998263

lldb/test/API/CMakeLists.txt

index 3124ca602e8e3a35fbb10ee129dec7d3f4913397..0078984c46b23b76b9d91b1828ea92d49d340537 100644 (file)
@@ -103,10 +103,17 @@ if(CMAKE_HOST_APPLE)
 
   if(LLDB_USE_SYSTEM_DEBUGSERVER)
     lldb_find_system_debugserver(system_debugserver_path)
-    add_custom_target(debugserver
-      COMMAND ${CMAKE_COMMAND} -E copy_if_different
-      ${system_debugserver_path} ${LLVM_RUNTIME_OUTPUT_INTDIR}
-      COMMENT "Copying the system debugserver to LLDB's binaries directory for testing.")
+    if(LLDB_BUILD_FRAMEWORK)
+      add_custom_target(debugserver
+        COMMAND ${CMAKE_COMMAND} -E copy_if_different
+        ${system_debugserver_path} $<TARGET_FILE_DIR:liblldb>/Resources
+        COMMENT "Copying the system debugserver to LLDB.framework's resource directory for testing.")
+    else()
+      add_custom_target(debugserver
+        COMMAND ${CMAKE_COMMAND} -E copy_if_different
+        ${system_debugserver_path} ${LLVM_RUNTIME_OUTPUT_INTDIR}
+        COMMENT "Copying the system debugserver to LLDB's binaries directory for testing.")
+    endif()
     message(STATUS "LLDB tests use out-of-tree debugserver: ${system_debugserver_path}")
     list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
     add_lldb_test_dependency(debugserver)