[PATCH] D54444: [CMake] Use extended llvm_codesign to pass entitlements for lldb-server

Stefan Gränitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 12 13:08:45 PST 2018


sgraenitz created this revision.
sgraenitz added reviewers: beanz, bogner.
Herald added a subscriber: mgorny.

This is using the mechanism proposed in https://reviews.llvm.org/D54443 to pass the entitlements file for lldb-server to llvm_codesign.


https://reviews.llvm.org/D54444

Files:
  CMakeLists.txt
  cmake/modules/AddLLDB.cmake
  tools/lldb-server/CMakeLists.txt


Index: tools/lldb-server/CMakeLists.txt
===================================================================
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -42,6 +42,16 @@
   list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF)
 endif()
 
+unset(entitlements)
+if(APPLE)
+  set(LLVM_CODESIGNING_IDENTITY ${LLDB_CODESIGN_IDENTITY})
+
+  if(LLDB_USE_ENTITLEMENTS AND NOT IOS)
+    # Same entitlements file as used for lldb-server
+    set(entitlements ${LLDB_SOURCE_DIR}/resources/debugserver-macosx-entitlements.plist)
+  endif()
+endif()
+
 add_lldb_tool(lldb-server INCLUDE_IN_SUITE
     Acceptor.cpp
     lldb-gdbserver.cpp
@@ -61,6 +71,9 @@
 
     LINK_COMPONENTS
       Support
+
+    ENTITLEMENTS
+      ${entitlements}
 )
 
 target_link_libraries(lldb-server PRIVATE ${LLDB_SYSTEM_LIBS})
Index: cmake/modules/AddLLDB.cmake
===================================================================
--- cmake/modules/AddLLDB.cmake
+++ cmake/modules/AddLLDB.cmake
@@ -100,13 +100,13 @@
 function(add_lldb_executable name)
   cmake_parse_arguments(ARG
     "INCLUDE_IN_SUITE;GENERATE_INSTALL"
-    ""
+    "ENTITLEMENTS"
     "LINK_LIBS;LINK_COMPONENTS"
     ${ARGN}
     )
 
   list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
-  add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
+  add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS} ENTITLEMENTS ${ARG_ENTITLEMENTS})
 
   target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})
   set_target_properties(${name} PROPERTIES
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -7,6 +7,8 @@
   "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
   )
 
+option(LLDB_USE_ENTITLEMENTS "When codesigning use entitlements if available" ON)
+
 include(LLDBStandalone)
 include(LLDBConfig)
 include(AddLLDB)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54444.173744.patch
Type: text/x-patch
Size: 1859 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181112/3070e183/attachment.bin>


More information about the llvm-commits mailing list