-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCodeSign.cmake
29 lines (24 loc) · 1.24 KB
/
CodeSign.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
##############################################################################
# #
# Copyright (C) 2023 MachineWare GmbH #
# All Rights Reserved #
# #
# This is work is licensed under the terms described in the LICENSE file #
# found in the root directory of this source tree. #
# #
##############################################################################
function(target_codesign target)
if(NOT APPLE)
return()
endif()
cmake_parse_arguments(CODESIGN "" "SIGNATURE" "ENTITLEMENTS" ${ARGN})
if(CODESIGN_SIGNATURE)
set(args --sign ${CODESIGN_SIGNATURE} --force $<TARGET_FILE:${target}>)
else()
set(args --sign - --force $<TARGET_FILE:${target}>)
endif()
if(CODESIGN_ENTITLEMENTS)
set(args ${args} --entitlements ${CODESIGN_ENTITLEMENTS})
endif()
add_custom_command(TARGET ${target} POST_BUILD COMMAND codesign ${args})
endfunction()