sign dylibs postbuild

This commit is contained in:
marauder2k7 2026-06-22 20:50:02 +01:00
parent 0fe6736634
commit 142bfc4382
2 changed files with 33 additions and 1 deletions

View file

@ -490,7 +490,11 @@ if (APPLE)
XCODE_ATTRIBUTE_ENABLE_TESTABILITY[variant=Debug] YES
XCODE_ATTRIBUTE_SDL_FILE_DIR[variant=Debug] parent
XCODE_ATTRIBUTE_SDL_FILE_DIR[variant=RelWithDebInfo] parent
XCODE_ATTRIBUTE_SDL_FILE_DIR[variant=Release] resource)
XCODE_ATTRIBUTE_SDL_FILE_DIR[variant=Release] resource
)
get_target_property(_sdl2_loc SDL2::SDL2 IMPORTED_LOCATION)
sign_dylib_post_build(${TORQUE_APP_NAME} "${_sdl2_loc}")
elseif (WIN32)
add_executable(${TORQUE_APP_NAME} WIN32 ${TORQUE_SOURCE_FILES})

View file

@ -64,4 +64,32 @@ set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks")
set(CMAKE_BUILD_RPATH "@executable_path/../Frameworks")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
function(sign_dylibs_post_build TARGET)
if(NOT APPLE)
return()
endif()
if(NOT ARGN)
message(WARNING "sign_dylibs_post_build: no dylibs provided for target '${TARGET}'")
return()
endif()
if(NOT DEFINED APPLE_CODESIGN_IDENTITY)
set(APPLE_CODESIGN_IDENTITY "-")
endif()
foreach(DYLIB_PATH IN LISTS ARGN)
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND codesign
--force
--sign "${APPLE_CODESIGN_IDENTITY}"
--timestamp
--options runtime
"${DYLIB_PATH}"
COMMENT "Signing ${DYLIB_PATH}"
VERBATIM
)
endforeach()
endfunction()
endif(APPLE)