cmake build_error ai_generated partial

CMake Error: CPack DMG: Code signing failed with error code 1

ID: cmake/cpack-dmg-signing-failure

Also available as: JSON · Markdown · 中文
75%Fix Rate
85%Confidence
1Evidence
2023-11-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
cmake 3.27.0 active
cmake 3.28.0 active
cmake 3.29.0 active

Root Cause

CPack DMG generator attempted to sign the disk image but the signing identity or entitlements are missing or invalid.

generic

中文

CPack DMG 生成器尝试对磁盘映像进行签名,但签名身份或授权缺失或无效。

Official Documentation

https://cmake.org/cmake/help/latest/module/CPackDMG.html

Workarounds

  1. 90% success Set CPACK_DMG_SKIP_CODESIGN to TRUE in CMakeLists.txt before including CPack: set(CPACK_DMG_SKIP_CODESIGN TRUE) include(CPack)
    Set CPACK_DMG_SKIP_CODESIGN to TRUE in CMakeLists.txt before including CPack:
    
    set(CPACK_DMG_SKIP_CODESIGN TRUE)
    include(CPack)
  2. 85% success Ensure a valid signing identity is available by running: security find-identity -v -p basic Then set CPACK_DMG_SIGNING_IDENTITY to the matching identity string: set(CPACK_DMG_SIGNING_IDENTITY "Developer ID Application: Your Name (TEAMID)")
    Ensure a valid signing identity is available by running:
    
    security find-identity -v -p basic
    
    Then set CPACK_DMG_SIGNING_IDENTITY to the matching identity string:
    
    set(CPACK_DMG_SIGNING_IDENTITY "Developer ID Application: Your Name (TEAMID)")

中文步骤

  1. 在 CMakeLists.txt 中,在包含 CPack 之前设置 CPACK_DMG_SKIP_CODESIGN 为 TRUE:
    
    set(CPACK_DMG_SKIP_CODESIGN TRUE)
    include(CPack)
  2. 通过运行以下命令确保存在有效的签名身份:
    
    security find-identity -v -p basic
    
    然后将 CPACK_DMG_SIGNING_IDENTITY 设置为匹配的身份字符串:
    
    set(CPACK_DMG_SIGNING_IDENTITY "Developer ID Application: Your Name (TEAMID)")

Dead Ends

Common approaches that don't work:

  1. Reinstall Xcode Command Line Tools 80% fail

    Xcode tools are usually not the issue; the problem is a missing or expired signing certificate, not the tools themselves.

  2. Set CPACK_DMG_DS_STORE to an empty path 90% fail

    This only changes the DS_Store file location, not the signing process; signing still fails.