Skip to content

Commit

Permalink
Adding code-signing function
Browse files Browse the repository at this point in the history
Meant only for MacOS/X, and mainly to avoid anoying pop-ups with MPI
programs.
  • Loading branch information
Mayeul d'Avezac committed Nov 5, 2015
1 parent 5b53917 commit f582c14
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions scripts/AddCodeSigning.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Adds the ability to do code signing for macos
# It avoids getting a pop-up all the time when running MPI codes.
# The process is as follows:
#
# Security nerds, avert your eyes.
#
# 1. create a *code-signing* certificate:
# - open key-chain access
# - select the login keychain (top-left panel)
# - menu KeyChain Access/Certificate Assistant/Create a certificate
# - choose a certificate name, self-signed, code-signing
# - curse Apple for not providing a command-line utility
# 1. run cmake with:
#
# ~~~bash
# cmake -DCERTIFICATE="certificate name" .
# ~~~
#
# 1. to every mpi target, add in the relevant CMakeLists.txt:
#
# ~~~CMake
# add_codesigning(targetname)
# ~~~
#
# 1. the very first time the certificate is used (during build) click always allow

set(CERTIFICATE "" CACHE STRING "Name of the certificate to use for code-signing")
function(add_codesign target)
if(APPLE AND CERTIFICATE)
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND codesign -f -s "${CERTIFICATE}" $<TARGET_FILE:${target}>
COMMENT "Codsigning ${target}"
VERBATIM
)
endif()
endfunction()

0 comments on commit f582c14

Please sign in to comment.