https://github.com/augusto2112 updated https://github.com/llvm/llvm-project/pull/177033
>From 775b7c21791e777c6d0c9cfe81f0e7b51eb932c5 Mon Sep 17 00:00:00 2001 From: Augusto Noronha <[email protected]> Date: Tue, 20 Jan 2026 13:58:27 -0800 Subject: [PATCH 1/4] [lldb][cmake] Fix standalone Xcode build header staging The LLDB standalone build using Xcode fails because the staging directory custom command output is attached to multiple liblldb-stage-header-* targets, but none of these targets depend on each other. Xcode's new build system doesn't allow this. This creates a new target `liblldb-header-staging-dir` that depends on the staging directory creation, and makes all header staging targets depend on it instead of directly depending on the directory in their custom commands. This ensures all targets share a common dependency, satisfying Xcode's build system requirements. --- lldb/source/API/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index e27f90f2e873d..b960f836acfc0 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -308,6 +308,11 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_header_staging_dir} COMMENT "LLDB headers: create staging directory for LLDB headers") +# Create a target for the staging directory so that all header staging targets +# can depend on it. This is required for Xcode's new build system which doesn't +# allow custom commands attached to multiple targets without a common dependency. +add_custom_target(liblldb-header-staging-dir DEPENDS ${lldb_header_staging_dir}) + find_program(unifdef_EXECUTABLE unifdef) add_custom_target(liblldb-header-staging) @@ -335,10 +340,10 @@ foreach(header endif() add_custom_target(liblldb-stage-header-${basename} DEPENDS ${staged_header}) - add_dependencies(liblldb-stage-header-${basename} lldb-sbapi-dwarf-enums) + add_dependencies(liblldb-stage-header-${basename} lldb-sbapi-dwarf-enums liblldb-header-staging-dir) add_dependencies(liblldb-header-staging liblldb-stage-header-${basename}) add_custom_command( - DEPENDS ${header} ${lldb_header_staging_dir} OUTPUT ${staged_header} + DEPENDS ${header} OUTPUT ${staged_header} COMMAND ${copy_command} COMMENT "LLDB headers: stage LLDB headers in include directory") >From c81f64b61d77a737a8e4b5a29111111790061c75 Mon Sep 17 00:00:00 2001 From: Augusto Noronha <[email protected]> Date: Tue, 20 Jan 2026 14:25:31 -0800 Subject: [PATCH 2/4] Combine custom command and custom target --- lldb/source/API/CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index b960f836acfc0..a44ed4e84c43a 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -303,16 +303,11 @@ list(REMOVE_ITEM root_public_headers ${root_private_headers}) # Skip the initial copy of lldb-defines.h. The fixed version is generated at build time. list(REMOVE_ITEM root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-defines.h) -add_custom_command( +add_custom_target(liblldb-header-staging-dir OUTPUT ${lldb_header_staging_dir} COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_header_staging_dir} COMMENT "LLDB headers: create staging directory for LLDB headers") -# Create a target for the staging directory so that all header staging targets -# can depend on it. This is required for Xcode's new build system which doesn't -# allow custom commands attached to multiple targets without a common dependency. -add_custom_target(liblldb-header-staging-dir DEPENDS ${lldb_header_staging_dir}) - find_program(unifdef_EXECUTABLE unifdef) add_custom_target(liblldb-header-staging) >From dbf20902655f2df30ceaf8a053a93b2ad4ad9ef0 Mon Sep 17 00:00:00 2001 From: Augusto Noronha <[email protected]> Date: Tue, 20 Jan 2026 15:16:34 -0800 Subject: [PATCH 3/4] Change parameter order --- lldb/source/API/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index a44ed4e84c43a..87c37fc698997 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -338,8 +338,9 @@ foreach(header add_dependencies(liblldb-stage-header-${basename} lldb-sbapi-dwarf-enums liblldb-header-staging-dir) add_dependencies(liblldb-header-staging liblldb-stage-header-${basename}) add_custom_command( - DEPENDS ${header} OUTPUT ${staged_header} + OUTPUT ${staged_header} COMMAND ${copy_command} + DEPENDS ${header} COMMENT "LLDB headers: stage LLDB headers in include directory") list(APPEND lldb_staged_headers ${staged_header}) >From d06e19f0622ac6fc411c7e52b3aa1eeabeeb0157 Mon Sep 17 00:00:00 2001 From: Augusto Noronha <[email protected]> Date: Wed, 21 Jan 2026 11:55:03 -0800 Subject: [PATCH 4/4] Back to one command and one target --- lldb/source/API/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index 87c37fc698997..22f920a0368d7 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -303,11 +303,13 @@ list(REMOVE_ITEM root_public_headers ${root_private_headers}) # Skip the initial copy of lldb-defines.h. The fixed version is generated at build time. list(REMOVE_ITEM root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-defines.h) -add_custom_target(liblldb-header-staging-dir +add_custom_command( OUTPUT ${lldb_header_staging_dir} COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_header_staging_dir} COMMENT "LLDB headers: create staging directory for LLDB headers") +add_custom_target(liblldb-header-staging-dir DEPENDS ${lldb_header_staging_dir}) + find_program(unifdef_EXECUTABLE unifdef) add_custom_target(liblldb-header-staging) _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
