[CMake] Accept entitlements for code signing in add_lldb_library()
authorStefan Granitz <stefan.graenitz@gmail.com>
Wed, 30 Jan 2019 15:13:16 +0000 (15:13 +0000)
committerStefan Granitz <stefan.graenitz@gmail.com>
Wed, 30 Jan 2019 15:13:16 +0000 (15:13 +0000)
Summary:
D57334 added entitlements support in `add_llvm_library()` so we can use it for library targets in LLDB.

Additionally this patch fixes the way that the entitlements argument is passed on from `add_lldb_executable()` to `add_llvm_executable()`. We still need the explicit parsing and passing on of single- and multi-value arguments as long as we are on CMake < 3.7 (due to bug https://gitlab.kitware.com/cmake/cmake/merge_requests/133).

Reviewers: beanz, JDevlieghere, aprantl

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, #lldb

Differential Revision: https://reviews.llvm.org/D57378

llvm-svn: 352629

lldb/cmake/modules/AddLLDB.cmake

index f82c11d..1adbe8c 100644 (file)
@@ -3,7 +3,7 @@ function(add_lldb_library name)
   # MODULE;SHARED;STATIC library type and source files
   cmake_parse_arguments(PARAM
     "MODULE;SHARED;STATIC;OBJECT;PLUGIN"
-    ""
+    "ENTITLEMENTS"
     "EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS"
     ${ARGN})
   llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
@@ -44,6 +44,10 @@ function(add_lldb_library name)
   if (PARAM_OBJECT)
     add_library(${name} ${libkind} ${srcs})
   else()
+    if(PARAM_ENTITLEMENTS)
+      set(pass_ENTITLEMENTS ENTITLEMENTS ${PARAM_ENTITLEMENTS})
+    endif()
+
     if(LLDB_NO_INSTALL_DEFAULT_RPATH)
       set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
     endif()
@@ -51,6 +55,7 @@ function(add_lldb_library name)
     llvm_add_library(${name} ${libkind} ${srcs}
       LINK_LIBS ${PARAM_LINK_LIBS}
       DEPENDS ${PARAM_DEPENDS}
+      ${pass_ENTITLEMENTS}
       ${pass_NO_INSTALL_RPATH}
     )
 
@@ -106,14 +111,19 @@ function(add_lldb_executable name)
     ${ARGN}
     )
 
+  if(ARG_ENTITLEMENTS)
+    set(pass_ENTITLEMENTS ENTITLEMENTS ${ARG_ENTITLEMENTS})
+  endif()
+
   if(LLDB_NO_INSTALL_DEFAULT_RPATH)
     set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
   endif()
 
   list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
-  add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS}
-    ENTITLEMENTS ${ARG_ENTITLEMENTS}
+  add_llvm_executable(${name}
+    ${pass_ENTITLEMENTS}
     ${pass_NO_INSTALL_RPATH}
+    ${ARG_UNPARSED_ARGUMENTS}
   )
 
   target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})