From d89f68e166bca04362f08a3ed493e963c605b37e Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Tue, 19 Nov 2013 21:37:09 +0000 Subject: [PATCH] CMake: Provide a possibility to automatically sign generated executables on Mac OSX git-svn-id: https://svn.dealii.org/trunk@31717 0785d39b-7218-0410-832d-ea1e28bc413d --- .../macro_deal_ii_invoke_autopilot.cmake | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake b/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake index 29867f93f8..eb63de08d1 100644 --- a/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake @@ -71,7 +71,9 @@ MACRO(DEAL_II_INVOKE_AUTOPILOT) SET(_command ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run_target.cmake ) + ELSE() + SET(_command ${TARGET_RUN}) ENDIF() @@ -86,6 +88,40 @@ MACRO(DEAL_II_INVOKE_AUTOPILOT) ) ENDIF() + + # + # Provide a target to sign the generated executable with a Mac OSX + # developer key. This avoids problems with an enabled firewall and MPI + # tasks that need networking. + # + + IF(CMAKE_SYSTEM_NAME MATCHES "Darwin") + IF(DEFINED OSX_CERTIFICATE_NAME) + ADD_CUSTOM_TARGET(sign ALL + COMMAND codesign -f -s ${OSX_CERTIFICATE_NAME} ${TARGET} + COMMENT "Digitally signing ${TARGET}" + DEPENDS ${TARGET} + VERBATIM + ) + ADD_DEPENDENCIES(run sign) + ELSE() + ADD_CUSTOM_TARGET(sign + COMMAND + ${CMAKE_COMMAND} -E echo '' + && ${CMAKE_COMMAND} -E echo '***************************************************************************' + && ${CMAKE_COMMAND} -E echo '** Error: No Mac OSX developer certificate specified' + && ${CMAKE_COMMAND} -E echo '** Please reconfigure with -DOSX_CERTIFICATE_NAME="<...>"' + && ${CMAKE_COMMAND} -E echo '***************************************************************************' + && ${CMAKE_COMMAND} -E echo '' + COMMENT "Digitally signing ${TARGET}" + ) + ENDIF() + + SET(_run_targets + "${_run_targets}#\n# $ make sign - to sign the executable with the supplied OSX developer key\n" + ) + ENDIF() + # Define custom targets to easily switch the build type: ADD_CUSTOM_TARGET(debug COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} -- 2.39.5