Skip to content

Commit

Permalink
Apple disable codesigning if no certificate exists
Browse files Browse the repository at this point in the history
  • Loading branch information
chris2511 committed Oct 1, 2023
1 parent 6dd1ceb commit ec9dd9a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ if (APPSTORE_COMPLIANT)
else()
set(APPLE_DEVELOPER_CERT "Developer ID Application")
endif()
if(APPLE)
execute_process(COMMAND security find-identity -v
ERROR_QUIET OUTPUT_VARIABLE IDCHECK)
string(FIND "${IDCHECK}" "${APPLE_DEVELOPER_CERT}" matchres)
if(matchres EQUAL -1)
unset(APPLE_DEVELOPER_CERT)
endif()
endif()

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand Down Expand Up @@ -180,7 +188,8 @@ if(APPLE)
endif()
if (DEFINED APPLE_DEVELOPER_CERT)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND codesign --deep --signature-size=96000 --options=runtime --timestamp
COMMAND codesign --deep --signature-size=96000
--options=runtime --timestamp
--entitlements ${PROJECT_SOURCE_DIR}/misc/entitlement${APPSTORE}.plist
--force -s ${APPLE_DEVELOPER_CERT}
$<TARGET_FILE_DIR:${PROJECT_NAME}>/../..
Expand Down

0 comments on commit ec9dd9a

Please sign in to comment.