[CMake] Get errors when executing shell scripts in post_build process as custom targets
    NoRulez 
    norulez at me.com
       
    Tue Nov 29 17:37:52 EST 2011
    
    
  
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111129/b5023da3/attachment-0001.htm>
    
    
More information about the CMake
mailing list