[llvm] r350383 - [CMake] Use XCODE_ATTRIBUTE properties for code signing and entitlements in Xcode
Stefan Granitz via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 4 01:22:32 PST 2019
Author: stefan.graenitz
Date: Fri Jan 4 01:22:32 2019
New Revision: 350383
URL: http://llvm.org/viewvc/llvm-project?rev=350383&view=rev
Log:
[CMake] Use XCODE_ATTRIBUTE properties for code signing and entitlements in Xcode
Summary: A post-commit comment to D55116 amended that this was the correct way for code signing in Xcode.
Reviewers: beanz
Reviewed By: beanz
Subscribers: mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D55816
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=350383&r1=350382&r2=350383&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Fri Jan 4 01:22:32 2019
@@ -1620,7 +1620,16 @@ function(llvm_codesign name)
return()
endif()
- if(APPLE)
+ if(CMAKE_GENERATOR STREQUAL "Xcode")
+ set_target_properties(${name} PROPERTIES
+ XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ${LLVM_CODESIGNING_IDENTITY}
+ )
+ if(DEFINED ARG_ENTITLEMENTS)
+ set_target_properties(${name} PROPERTIES
+ XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${ARG_ENTITLEMENTS}
+ )
+ endif()
+ elseif(APPLE)
if(NOT CMAKE_CODESIGN)
set(CMAKE_CODESIGN xcrun codesign)
endif()
@@ -1634,18 +1643,13 @@ function(llvm_codesign name)
if(DEFINED ARG_ENTITLEMENTS)
set(pass_entitlements --entitlements ${ARG_ENTITLEMENTS})
endif()
- if(CMAKE_GENERATOR STREQUAL "Xcode")
- # Avoid double-signing error: Since output overwrites input, Xcode runs
- # the post-build rule even if the actual build-step was skipped.
- set(pass_force --force)
- endif()
add_custom_command(
TARGET ${name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
env CODESIGN_ALLOCATE=${CMAKE_CODESIGN_ALLOCATE}
${CMAKE_CODESIGN} -s ${LLVM_CODESIGNING_IDENTITY}
- ${pass_entitlements} ${pass_force} $<TARGET_FILE:${name}>
+ ${pass_entitlements} $<TARGET_FILE:${name}>
)
endif()
endfunction()
More information about the llvm-commits
mailing list