Skip to content

Commit

Permalink
Windows|CMake: Sign executables if certificate provided
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Mar 21, 2016
1 parent dbb5e7e commit c022c55
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doomsday/cmake/Macros.cmake
Expand Up @@ -443,6 +443,10 @@ macro (deng_codesign target)
\"\${CMAKE_INSTALL_PREFIX}/${_outName}.app\"
)")
endif ()
if (WIN32 AND DENG_SIGNTOOL_CERT)
get_property (_outName TARGET ${target} PROPERTY OUTPUT_NAME)
deng_signtool (${CMAKE_INSTALL_PREFIX}/bin/${_outName}.exe)
endif ()
endmacro ()

# Defines a new GUI application target that includes all the required Doomsday
Expand Down
1 change: 1 addition & 0 deletions doomsday/cmake/PlatformMacx.cmake
Expand Up @@ -7,6 +7,7 @@ set (DENG_AMETHYST_PLATFORM MACOSX)
set (DENG_INSTALL_DOC_DIR "Doomsday.app/Contents/Resources/doc")
set (DENG_INSTALL_MAN_DIR ${DENG_INSTALL_DOC_DIR})

# Code signing.
set (DENG_CODESIGN_APP_CERT "" CACHE STRING "ID of the certificate for signing applications.")
find_program (CODESIGN_COMMAND codesign)
mark_as_advanced (CODESIGN_COMMAND)
Expand Down
18 changes: 18 additions & 0 deletions doomsday/cmake/PlatformWindows.cmake
Expand Up @@ -14,6 +14,24 @@ add_definitions (
-D_USE_MATH_DEFINES
)

# Code signing.
set (DENG_SIGNTOOL_CERT "" CACHE FILEPATH "Path of the certificate for signing files.")
set (DENG_SIGNTOOL_PASSPHRASE "" CACHE STRING "Signing certificate passphrase.")
find_program (SIGNTOOL_COMMAND signtool)
mark_as_advanced (SIGNTOOL_COMMAND)

function (deng_signtool path)
install (CODE "
message (STATUS "\Signing ${path}...\")
execute_process (COMMAND ${SIGNTOOL_COMMAND}
/f ${DENG_SIGNTOOL_CERT}
/p ${DENG_SIGNTOOL_PASSPHRASE}
/t http://timestamp.verisign.com/scripts/timstamp.dll
\"${path}\"
)"
)
endfunction ()
if (MSVC)
add_definitions (
-DMSVC
Expand Down

0 comments on commit c022c55

Please sign in to comment.