build(cmake): fix code signing

This commit is contained in:
Oleg Shparber
2026-02-28 02:53:59 +02:00
parent 7b13916964
commit 705ae49fbb
+13 -2
View File
@@ -155,6 +155,7 @@ function(codesign)
execute_process(COMMAND "certutil.exe" ${_cmd_certutil_args}
RESULT_VARIABLE _rc
OUTPUT_VARIABLE _stdout
# For some reason certutil prints errors to stdout.
# ERROR_VARIABLE _stderr
)
@@ -162,12 +163,14 @@ function(codesign)
file(REMOVE ${_certificate_base64_file})
if(NOT _rc EQUAL 0)
# For some reason certutil prints errors to stdout.
message(WARNING "Failed to decode certificate: ${_stdout}")
_cleanup()
return()
endif()
unset(_rc)
unset(_stdout)
set(_ARG_CERTIFICATE_FILE ${_certificate_file})
else()
message(NOTICE "Certificate is not provided, no binaries will be signed.")
@@ -216,7 +219,7 @@ function(codesign)
# Set timestamp server.
if(NOT _ARG_TIMESTAMP_URL)
set(_ARG_TIMESTAMP_URL "https://timestamp.digicert.com")
set(_ARG_TIMESTAMP_URL "http://timestamp.digicert.com")
endif()
if(_ARG_TIMESTAMP_URL)
@@ -242,6 +245,14 @@ function(codesign)
continue()
endif()
message(STATUS "Signing ${_file}...")
execute_process(
COMMAND "${_cmd}" ${_cmd_args} "${_file}"
RESULT_VARIABLE _rc
OUTPUT_VARIABLE _stdout
ERROR_VARIABLE _stderr
)
if(_rc EQUAL 0)
message(STATUS "Successfully signed: ${_file}")
else()