From e03d279ac197759997d59cf07baf53136d8b7fcc Mon Sep 17 00:00:00 2001 From: Stefan Granitz Date: Mon, 3 Dec 2018 10:42:32 +0000 Subject: [PATCH] [CMake] Add LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR for custom dSYM target directory on Darwin Summary: When using `LLVM_EXTERNALIZE_DEBUGINFO` in LLDB, the default dSYM location for the shared library in LLDB.framework is inside the framework bundle. With `LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR` we can easily fix that. I consider it a useful feature to be able to set a global output directory for external debug info (rather then having a target-specific one). Only implemented for Darwin so far. Reviewers: beanz, aprantl Reviewed By: aprantl Subscribers: mgorny, aprantl, #lldb, lldb-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D55114 llvm-svn: 348118 --- cmake/modules/AddLLVM.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 02ce5479c10..3e2f4f98a97 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -1597,6 +1597,13 @@ function(llvm_externalize_debuginfo name) endif() endif() + if(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR) + if(APPLE) + set(output_name "$.dSYM") + set(output_path "-o=${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR}/${output_name}") + endif() + endif() + if(APPLE) if(CMAKE_CXX_FLAGS MATCHES "-flto" OR CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE} MATCHES "-flto") @@ -1609,7 +1616,7 @@ function(llvm_externalize_debuginfo name) set(CMAKE_DSYMUTIL xcrun dsymutil) endif() add_custom_command(TARGET ${name} POST_BUILD - COMMAND ${CMAKE_DSYMUTIL} $ + COMMAND ${CMAKE_DSYMUTIL} ${output_path} $ ${strip_command} ) else()