Hi there!

I added another improvement to the codesign feature. Sometimes it is
helpful to overwrite or pass additional parameters like "--timestamp=none"
to codesign.
But this shouldn't be the default for everyone.

So I added the variable CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER.
Hope you like it.

Regards
  André


2015-02-20 16:20 GMT+01:00 Clinton Stimpson <clin...@elemtech.com>:

> On Friday, February 20, 2015 12:07:55 PM A. Klitzing wrote:
> > Hi Clint,
> >
> > I have another patch to tweak the error output a little bit. If codesign
> > fails it won't be possible to get the error message of codesign itself.
> > That is a little bit confusing because it just fails without an
> > understandable reason.
> >
> > This patch will print the output of codesign if it fails.
> >
>
> Thanks.
>
> <http://www.cmake.org/gitweb?p=cmake.git;a=commit;h=7b582d1>
>
> Clint
>
From 6dda0e51c7fb8bf3422e4e208980a5d018910c4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= <aklitz...@gmail.com>
Date: Wed, 11 Mar 2015 13:04:15 +0100
Subject: [PATCH] CPack: Add support to overwrite or pass additional parameter
 to codesign

---
 Modules/CPackBundle.cmake               |  5 +++++
 Source/CPack/cmCPackBundleGenerator.cxx | 10 +++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git x/Modules/CPackBundle.cmake y/Modules/CPackBundle.cmake
index d26a0b3..b412216 100644
--- x/Modules/CPackBundle.cmake
+++ y/Modules/CPackBundle.cmake
@@ -52,6 +52,11 @@
 #  list the main application folder, or the main executable. You should
 #  list any frameworks and plugins that are included in your app bundle.
 #
+# .. variable:: CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER
+#
+#  Additional parameter that will passed to codesign.
+#  Default value: "--deep -f"
+#
 # .. variable:: CPACK_COMMAND_CODESIGN
 #
 #  Path to the codesign(1) command used to sign applications with an
diff --git x/Source/CPack/cmCPackBundleGenerator.cxx y/Source/CPack/cmCPackBundleGenerator.cxx
index 6e7a26b..01c3f8b 100644
--- x/Source/CPack/cmCPackBundleGenerator.cxx
+++ y/Source/CPack/cmCPackBundleGenerator.cxx
@@ -221,6 +221,10 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
     bundle_path += ".app";
 
     // A list of additional files to sign, ie. frameworks and plugins.
+    const std::string sign_parameter =
+      this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER")
+      ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_PARAMETER") : "--deep -f";
+
     const std::string sign_files =
       this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES")
       ? this->GetOption("CPACK_BUNDLE_APPLE_CODESIGN_FILES") : "";
@@ -234,7 +238,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
       {
       std::ostringstream temp_sign_file_cmd;
       temp_sign_file_cmd << this->GetOption("CPACK_COMMAND_CODESIGN");
-      temp_sign_file_cmd << " --deep -f -s \"" << cpack_apple_cert_app;
+      temp_sign_file_cmd << " " << sign_parameter << " -s \"" << cpack_apple_cert_app;
       temp_sign_file_cmd << "\" -i ";
       temp_sign_file_cmd << this->GetOption("CPACK_APPLE_BUNDLE_ID");
       temp_sign_file_cmd << " \"";
@@ -254,7 +258,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
     // sign main binary
     std::ostringstream temp_sign_binary_cmd;
     temp_sign_binary_cmd << this->GetOption("CPACK_COMMAND_CODESIGN");
-    temp_sign_binary_cmd << " --deep -f -s \"" << cpack_apple_cert_app;
+    temp_sign_binary_cmd << " " << sign_parameter << " -s \"" << cpack_apple_cert_app;
     temp_sign_binary_cmd << "\" \"" << bundle_path << "\"";
 
     if(!this->RunCommand(temp_sign_binary_cmd, &output))
@@ -269,7 +273,7 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
     // sign app bundle
     std::ostringstream temp_codesign_cmd;
     temp_codesign_cmd << this->GetOption("CPACK_COMMAND_CODESIGN");
-    temp_codesign_cmd << " --deep -f -s \"" << cpack_apple_cert_app << "\"";
+    temp_codesign_cmd << " " << sign_parameter << " -s \"" << cpack_apple_cert_app << "\"";
     if(this->GetOption("CPACK_BUNDLE_APPLE_ENTITLEMENTS"))
       {
       temp_codesign_cmd << " --entitlements ";
-- 
2.3.2

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to