[CMake] Need to run scripts during packaging

Bill Hoffman bill.hoffman at kitware.com
Fri Nov 13 21:04:28 EST 2009


Michael Jackson wrote:
> 
> On Nov 13, 2009, at 7:23 PM, Clinton Stimpson wrote:
> 
>> On Friday 13 November 2009 05:05:36 pm Michael Jackson wrote:
>>> OS X classic dylib problems. My Dylibs have the full path as their
>>> "install_name". When I do a "make install" I have scripts run over
>>> those libraries to "fix them up" using the BundleUtilities.cmake
>>> stuff. Um, so how do I get those same scripts to run when I do a "make
>>> package" ?
>>>
>>
>> How about doing an install(SCRIPT ...), where the specified script can 
>> include
>> BundleUtilities and call fixup_bundle().
>>
>> Clint
>>
> Yep. I have the following:
> 
> # -------- Function to build OS X Stand Alone Bundles -----------------
> macro(MakeOSXTool target binary_dir osx_tools_dir)
>     set(target ${target})
>     set(binary_dir ${binary_dir})
>     set(osx_tools_dir ${osx_tools_dir})
> 
>   SET (OSX_MAKE_STANDALONE_TOOL_CMAKE_SCRIPT 
> "${binary_dir}/OS_X_Scripts/${target}_OSX_MakeStandAloneTool.cmake")
> 
>   CONFIGURE_FILE("${osx_tools_dir}/CompleteTool.cmake.in"
>     "${OSX_MAKE_STANDALONE_TOOL_CMAKE_SCRIPT}" @ONLY IMMEDIATE)
> 
>   install(SCRIPT "${OSX_MAKE_STANDALONE_TOOL_CMAKE_SCRIPT}")
> 
> endmacro(MakeOSXTool)
> 
> And when I do a "make install" the generated script file does indeed 
> run. When I do "make package" the scripts are not run.
> 
The install target is always run prior to make package?   CPack works by 
running the install rule, then packaging up the results.  So, your 
script has to be run by cpack...

-Bill



More information about the CMake mailing list