From 5e0b709c1446aa64b823ac70fc3c88e607d3b24a Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Thu, 13 May 2021 19:33:07 +0200 Subject: [PATCH] (macOS) Added a CMake variable for defining the code signing certificate identity. --- CMakeLists.txt | 5 +++++ es-app/CMakeLists.txt | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e16a95de..707f33314 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,8 @@ if(APPLE) # Set this to the operating system version you're building on, and also update # es-app/assets/EmulationStation-DE_Info.plist accordingly. set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "macOS deployment target") + # This optional variable is used for code signing the DMG installer. + set(MACOS_CODESIGN_IDENTITY "" CACHE STRING "macOS code signing certificate identity") endif() project(emulationstation-de) @@ -166,6 +168,9 @@ if(APPLE) endif() if(APPLE) + if(MACOS_CODESIGN_IDENTITY) + message("-- Code signing certificate identity: " ${MACOS_CODESIGN_IDENTITY}) + endif() if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.14) message("-- macOS version 10.13 or lower has been set, so if code signing is enabled, Hardened Runtime will not be used") endif() diff --git a/es-app/CMakeLists.txt b/es-app/CMakeLists.txt index ef683b059..0f1aecf08 100644 --- a/es-app/CMakeLists.txt +++ b/es-app/CMakeLists.txt @@ -276,11 +276,12 @@ if(APPLE) set(CPACK_BUNDLE_NAME "EmulationStation Desktop Edition") set(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE.icns") set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE_Info.plist") - # Uncomment the following lines and change to your certificate identity to enable code signing. - #set(CPACK_BUNDLE_APPLE_CERT_APP "Developer ID Application: ") - #if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_GREATER 10.13) - # set(CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER "--deep --force --options runtime") - #endif() + if(MACOS_CODESIGN_IDENTITY) + set(CPACK_BUNDLE_APPLE_CERT_APP "Developer ID Application: ${MACOS_CODESIGN_IDENTITY}") + if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_GREATER 10.13) + set(CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER "--deep --force --options runtime") + endif() + endif() elseif(WIN32) set(CPACK_GENERATOR "NSIS") set(CPACK_PACKAGE_FILE_NAME "EmulationStation-DE-${CPACK_PACKAGE_VERSION}-${CPU_ARCHITECTURE}")