[Lldb-commits] [PATCH] D54443: [CMake] Accept ENTITLEMENTS in add_llvm_executable and llvm_codesign
Stefan Gränitz via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 12 13:05:42 PST 2018
sgraenitz created this revision.
sgraenitz added reviewers: beanz, bogner.
Herald added a subscriber: mgorny.
Allow code-signing with entitlements. FORCE may be used to avoid an error when replacing existing signatures.
Repository:
rL LLVM
https://reviews.llvm.org/D54443
Files:
cmake/modules/AddLLVM.cmake
Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -580,7 +580,7 @@
if(ARG_SHARED OR ARG_MODULE)
llvm_externalize_debuginfo(${name})
- llvm_codesign(${name})
+ llvm_codesign(TARGET ${name})
endif()
endfunction()
@@ -708,7 +708,12 @@
macro(add_llvm_executable name)
- cmake_parse_arguments(ARG "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" "" "DEPENDS" ${ARGN})
+ cmake_parse_arguments(ARG
+ "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH"
+ "ENTITLEMENTS"
+ "DEPENDS"
+ ${ARGN})
+
llvm_process_sources( ALL_FILES ${ARG_UNPARSED_ARGUMENTS} )
list(APPEND LLVM_COMMON_DEPENDS ${ARG_DEPENDS})
@@ -787,7 +792,7 @@
target_link_libraries(${name} PRIVATE ${LLVM_PTHREAD_LIB})
endif()
- llvm_codesign(${name})
+ llvm_codesign(TARGET ${name} ENTITLEMENTS ${ARG_ENTITLEMENTS} FORCE)
endmacro(add_llvm_executable name)
function(export_executable_symbols target)
@@ -1626,7 +1631,15 @@
endif()
endfunction()
-function(llvm_codesign name)
+# Usage: llvm_codesign(TARGET name [ENTITLEMENTS file] [FORCE])
+#
+# Code-sign the given TARGET with the global LLVM_CODESIGNING_IDENTITY or skip
+# if undefined. Customize capabilities by passing a file path to ENTITLEMENTS.
+# FORCE may be used to avoid an error when replacing existing signatures.
+#
+function(llvm_codesign)
+ cmake_parse_arguments(ARG "FORCE" "TARGET;ENTITLEMENTS" "" ${ARGN})
+
if(NOT LLVM_CODESIGNING_IDENTITY)
return()
endif()
@@ -1642,12 +1655,20 @@
OUTPUT_VARIABLE CMAKE_CODESIGN_ALLOCATE
)
endif()
+ if(DEFINED ARG_FORCE)
+ set(PASS_FORCE --force)
+ endif()
+ if(DEFINED ARG_ENTITLEMENTS)
+ set(PASS_ENTITLEMENTS --entitlements ${ARG_ENTITLEMENTS})
+ endif()
+
add_custom_command(
- TARGET ${name} POST_BUILD
+ TARGET ${ARG_TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
env CODESIGN_ALLOCATE=${CMAKE_CODESIGN_ALLOCATE}
${CMAKE_CODESIGN} -s ${LLVM_CODESIGNING_IDENTITY}
- $<TARGET_FILE:${name}>
+ ${PASS_ENTITLEMENTS} ${PASS_FORCE}
+ $<TARGET_FILE:${ARG_TARGET}>
)
endif()
endfunction()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54443.173742.patch
Type: text/x-patch
Size: 2347 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181112/57083ddd/attachment.bin>
More information about the lldb-commits
mailing list