diff options
author | lazydodo <github@lazydodo.com> | 2016-08-31 15:26:05 +0300 |
---|---|---|
committer | lazydodo <github@lazydodo.com> | 2016-08-31 15:26:23 +0300 |
commit | 8fb9f2dbe9cb69476bf1f98c8503e5acd446c5b0 (patch) | |
tree | ab93752f669309bd0b4774a7dd55eace1f95e919 /build_files/cmake/macros.cmake | |
parent | b06a70323c1ae8ead6e1249b70a201fff36c660f (diff) |
[Windows] Add support for code signing the final binaries.
The option is controlled with the WITH_WINDOWS_CODESIGN option and needs:
- Signtool must be found on the system, the standard windows sdk folders will be searched for it.
- The path to the pfx file (WINDOWS_CODESIGN_PFX)
- The password for the pfx , this can either be set by the WINDOWS_CODESIGN_PFX_PASSWORD variable but given that ends up in CMakeCache.txt (which might be undesirable) there is a backup option of setting the PFXPASSWORD environment variable on the system.
Reviewers: sergey, juicyfruit
Reviewed By: juicyfruit
Tags: #bf_blender, #platform:_windows
Differential Revision: https://developer.blender.org/D2182
Diffstat (limited to 'build_files/cmake/macros.cmake')
-rw-r--r-- | build_files/cmake/macros.cmake | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index dc8b158f5c0..fabb35c539e 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1578,3 +1578,26 @@ macro(openmp_delayload endif(WITH_OPENMP) endif(MSVC) endmacro() + +MACRO(WINDOWS_SIGN_TARGET target) + if (WITH_WINDOWS_CODESIGN) + if (!SIGNTOOL_EXE) + error("Codesigning is enabled, but signtool is not found") + else() + if (WINDOWS_CODESIGN_PFX_PASSWORD) + set(CODESIGNPASSWORD /p ${WINDOWS_CODESIGN_PFX_PASSWORD}) + else() + if ($ENV{PFXPASSWORD}) + set(CODESIGNPASSWORD /p $ENV{PFXPASSWORD}) + else() + message( FATAL_ERROR "WITH_WINDOWS_CODESIGN is on but WINDOWS_CODESIGN_PFX_PASSWORD not set, and environment variable PFXPASSWORD not found, unable to sign code.") + endif() + endif() + add_custom_command(TARGET ${target} + POST_BUILD + COMMAND ${SIGNTOOL_EXE} sign /f ${WINDOWS_CODESIGN_PFX} ${CODESIGNPASSWORD} $<TARGET_FILE:${target}> + VERBATIM + ) + endif() + endif() +ENDMACRO()
\ No newline at end of file |