diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -1604,14 +1604,21 @@ endif() endif() - if(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR) - if(APPLE) - set(output_name "$.dSYM") + if(APPLE) + if(LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION) + set(file_ext ${LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION}) + else() + set(file_ext dSYM) + endif() + + set(output_name "$.${file_ext}") + + if(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR) set(output_path "-o=${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR}/${output_name}") + else() + set(output_path "-o=${output_name}") endif() - endif() - if(APPLE) if(CMAKE_CXX_FLAGS MATCHES "-flto" OR CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE} MATCHES "-flto")