[CMake] Get errors when executing shell scripts in post_build process as custom targets

NoRulez norulez at me.com
Tue Nov 29 18:57:19 EST 2011


Much thanks,

 

could this command be done with the BundleUtilities too?

 

        ADD_CUSTOM_COMMAND(TARGET Custom1 POST_BUILD

                           COMMAND /usr/bin/macdeployqt ${PROJECT_NAME}.app

                           WORKING_DIRECTORY
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}

                           COMMENT “Prepare for deployment”

                           VERBATIM)

 

Thanks in advance

Best Regards

 

-----Ursprüngliche Nachricht-----
Von: David Cole [mailto:david.cole at kitware.com] 
Gesendet: Dienstag, 29. November 2011 23:44
An: NoRulez
Cc: CMake MailingList
Betreff: Re: [CMake] Get errors when executing shell scripts in post_build
process as custom targets

 

The double quoting is wrong.

 

Do this (no quotes necessary):

 

  COMMAND /usr/bin/macdeployqt ${BUNDLE_IDENTIFIER}

 

Not this:

 

  COMMAND "/usr/bin/macdeployqt ${BUNDLE_IDENTIFIER}"

 

 

HTH,

David

 

 

On Tue, Nov 29, 2011 at 5:37 PM, NoRulez < <mailto:norulez at me.com>
norulez at me.com> wrote:

> Hi,

> 

> 

> 

> I want to do something after the bundle is created (POST_BUILD). For 

> this I tried the following:

> 

> 

> 

> ADD_EXECUTABLE(...)

> 

> TARGET_LINK_LIBRARIES(...)

> 

> ADD_DEPENDECIES(...)

> 

> 

> 

> IF (APPLE)

> 

>         SET(BUNDLE_IDENTIFIER

> "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app")

> 

> 

> 

>         ADD_CUSTOM_TARGET(Custom1 ALL DEPENDS ${BUNDLE_IDENTIFIER})

> 

> 

> 

>         ADD_CUSTOM_COMMAND(TARGET Custom1 POST_BUILD

> 

>                            COMMAND "/usr/bin/macdeployqt 

> ${PROJECT_NAME}.app"

> 

>                            #COMMAND "/usr/bin/macdeployqt 

> ${BUNDLE_IDENTIFIER}"

> 

>                            WORKING_DIRECTORY 

> "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"

> 

>                            COMMENT “Prepare for deployment”

> 

>                            VERBATIM)

> 

>         ADD_CUSTOM_COMMAND(TARGET Custom1 POST_BUILD

> 

>                            COMMAND /usr/bin/security 

> $ENV{HOME}/Library/Keychains/login.keychain"

> 

>                            COMMENT “Unlock the keychain”

> 

>                            VERBATIM)

> 

>         ADD_CUSTOM_COMMAND(TARGET Custom1 POST_BUILD

> 

>                            COMMAND /usr/bin/codesign --force --verbose 

> --verify --sign \"${APPLICATION_CERTIFICATE}\" ${BUNDLE_IDENTIFIER}"

> 

>                            COMMENT “Sign the application bundle”

> 

>                            VERBATIM)

> 

>         ADD_CUSTOM_COMMAND(TARGET Custom1 POST_BUILD

> 

>                            COMMAND /usr/bin/productbuild --component 

> \"${BUNDLE_IDENTIFIER}\" /Applications --sign \"${INSTALLER_CERTIFICATE}\"

> --product \"${BUNDLE_IDENTIFIER}/Contents/Info.plist\"
${PROJECT_NAME}.pkg"

> 

>                            WORKING_DIRECTORY 

> "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"

> 

>                            COMMENT “Build package”

> 

>                            VERBATIM)

> 

> ENDIF(APPLE)

> 

> 

> 

> But I get the the following error:

> 

> /bin/sh: /usr/bin/macdeployqt MyApp.app: No such file or directory

> 

> make[2]: *** [Custom1] Error 127

> 

> make[1]: *** [app/CMakeFiles/Custom1.dir/all] Error 2

> 

> make: *** [all] Error 2

> 

> 

> 

> I also tried to use the full path to the bundle but I get the same error.

> 

> 

> 

> Does anyone know where could be the problem?

> 

> Maybe this can also be done with the BundleUtilities?

> 

> 

> 

> Thanks in advance

> 

> 

> 

> Best Regards

> 

> NoRulez

> 

> 

> --

> 

> Powered by  <http://www.kitware.com> www.kitware.com

> 

> Visit other Kitware open-source projects at 

>  <http://www.kitware.com/opensource/opensource.html>
http://www.kitware.com/opensource/opensource.html

> 

> Please keep messages on-topic and check the CMake FAQ at:

>  <http://www.cmake.org/Wiki/CMake_FAQ> http://www.cmake.org/Wiki/CMake_FAQ

> 

> Follow this link to subscribe/unsubscribe:

>  <http://www.cmake.org/mailman/listinfo/cmake>
http://www.cmake.org/mailman/listinfo/cmake

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111130/fd4d036e/attachment-0001.htm>


More information about the CMake mailing list