[CMake] BundleUtilities without install target as post build process?

David Cole david.cole at kitware.com
Fri Dec 2 14:38:51 EST 2011


The answer to "Is this possible?" is almost nearly always "yes, of course."

The wiki page http://www.cmake.org/Wiki/BundleUtilitiesExample shows a
basic code snippet like this:

set(APPS ...)  # paths to executables
set(DIRS ...)   # directories to search for prerequisites
INSTALL(CODE "
   include(BundleUtilities)
   fixup_bundle(\"${APPS}\"   \"\"   \"${DIRS}\")
   " COMPONENT Runtime)

This encodes some CMake code into a CMake script file that runs at
"make install" time...

To do the equivalent at build time, whether as a post_build step or as
a custom target that depends on the bundled executable, the easiest
way to do it is what Mike already suggested: configure a cmake script
file to make the same calls that are presently made at install time.

Why are you averse to using a script file to achieve your goal?

Caveats: one thing to remember is that the install time fixup that
BundleUtilities does is often an expensive operation, and you don't
want to do it unless you have to. Another thing to remember is that it
operates on the installed bundle app, and modifies the executable and
copies files into the tree. If you do the same thing at build time to
the copy of your app in the build tree, then you may encounter
different results than running it in the install tree. Some files are
required to be copied into their expected locations within the bundle
before calling fixup_bundle... The install tree bundle and build tree
bundles probably have different files in them unless you also copy all
those libraries into the bundle as a build time step, too.

It may be better to simply do a "make install" rather than trying to
use BundleUtilities strictly at build time...


David


On Fri, Dec 2, 2011 at 1:33 PM,  <norulez at me.com> wrote:
> Thanks but I mean only within a CMakeLists file (add_custom_target) without an extra file.
>
> Is this possible?
>
> Best Regards
>
> Am 02.12.2011 um 17:56 schrieb Michael Jackson <mike.jackson at bluequartz.net>:
>
>> Just thinking out loud here:
>>
>> Create a shell script template.
>> Configure the template at cmake time
>> Run the script as a POST_BUILD custom target.
>>
>> Inside the custom script you would call cmake with the specific bundleUtilities code that you need to "fix up" the application.
>> ___________________________________________________________
>> Mike Jackson                    Principal Software Engineer
>> BlueQuartz Software                            Dayton, Ohio
>> mike.jackson at bluequartz.net              www.bluequartz.net
>>
>> On Dec 2, 2011, at 10:58 AM, norulez at me.com wrote:
>>
>>> Hi,
>>>
>>> i want to build an application bundle (on Mac OS X) where the dependencies are solved.
>>>
>>> Normally I use BundleUtilities in combination with cpack as described in the BundleUtilities example to do so.
>>>
>>> However, is there a way to run the BundleUtilities as a post build process?
>>>
>>> Thanks in advance
>>>
>>> Best Regards
>>> NoRulez
>>> --
>>>
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at 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
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.cmake.org/mailman/listinfo/cmake
>>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list