diff options
Diffstat (limited to 'lldb/cmake/modules/AddLLDB.cmake')
-rw-r--r-- | lldb/cmake/modules/AddLLDB.cmake | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lldb/cmake/modules/AddLLDB.cmake b/lldb/cmake/modules/AddLLDB.cmake index 540d01362f0..4c99278c583 100644 --- a/lldb/cmake/modules/AddLLDB.cmake +++ b/lldb/cmake/modules/AddLLDB.cmake @@ -276,3 +276,27 @@ function(lldb_setup_rpaths name) INSTALL_RPATH "${LIST_INSTALL_RPATH}" ) endfunction() + +function(lldb_find_system_debugserver path) + execute_process(COMMAND xcode-select -p + RESULT_VARIABLE exit_code + OUTPUT_VARIABLE xcode_dev_dir + ERROR_VARIABLE error_msg + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(exit_code) + message(WARNING "`xcode-select -p` failed:\n${error_msg}") + else() + set(subpath "LLDB.framework/Resources/debugserver") + set(path_shared "${xcode_dev_dir}/../SharedFrameworks/${subpath}") + set(path_private "${xcode_dev_dir}/Library/PrivateFrameworks/${subpath}") + + if(EXISTS ${path_shared}) + set(${path} ${path_shared} PARENT_SCOPE) + elseif(EXISTS ${path_private}) + set(${path} ${path_private} PARENT_SCOPE) + else() + message(WARNING "System debugserver requested, but not found. " + "Candidates don't exist: ${path_shared}\n${path_private}") + endif() + endif() +endfunction() |