]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Provide a possibility to automatically sign generated executables on Mac OSX
authorMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 19 Nov 2013 21:37:09 +0000 (21:37 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 19 Nov 2013 21:37:09 +0000 (21:37 +0000)
git-svn-id: https://svn.dealii.org/trunk@31717 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake

index 29867f93f8b4ce3c29632b3a7ef53a1747eb0a97..eb63de08d190bf6d42e90a78034407b1a7248685 100644 (file)
@@ -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}

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.