llvm.org GIT mirror llvm / 9128e2a
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350383 91177308-0d34-0410-b5e6-96231b3b80d8 Stefan Granitz 9 months ago
1 changed file(s) with 11 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
16191619 return()
16201620 endif()
16211621
1622 if(APPLE)
1622 if(CMAKE_GENERATOR STREQUAL "Xcode")
1623 set_target_properties(${name} PROPERTIES
1624 XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ${LLVM_CODESIGNING_IDENTITY}
1625 )
1626 if(DEFINED ARG_ENTITLEMENTS)
1627 set_target_properties(${name} PROPERTIES
1628 XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${ARG_ENTITLEMENTS}
1629 )
1630 endif()
1631 elseif(APPLE)
16231632 if(NOT CMAKE_CODESIGN)
16241633 set(CMAKE_CODESIGN xcrun codesign)
16251634 endif()
16331642 if(DEFINED ARG_ENTITLEMENTS)
16341643 set(pass_entitlements --entitlements ${ARG_ENTITLEMENTS})
16351644 endif()
1636 if(CMAKE_GENERATOR STREQUAL "Xcode")
1637 # Avoid double-signing error: Since output overwrites input, Xcode runs
1638 # the post-build rule even if the actual build-step was skipped.
1639 set(pass_force --force)
1640 endif()
16411645
16421646 add_custom_command(
16431647 TARGET ${name} POST_BUILD
16441648 COMMAND ${CMAKE_COMMAND} -E
16451649 env CODESIGN_ALLOCATE=${CMAKE_CODESIGN_ALLOCATE}
16461650 ${CMAKE_CODESIGN} -s ${LLVM_CODESIGNING_IDENTITY}
1647 ${pass_entitlements} ${pass_force} $
1651 ${pass_entitlements} $
16481652 )
16491653 endif()
16501654 endfunction()