Rather than just doing a "fixup_bundle" as an INSTALL(CODE snippet, put it in a separate CMake script, and use install(SCRIPT to execute it. You can configure the script with configure_file if you need to put stuff in it that depends on CMake variables.<div>
<br></div><div>Then, in your script:</div><div><br></div><div> # Define the function before including BundleUtilities:</div><div><div> function(gp_resolved_file_type_override resolved_file type_var)</div><div><span class="Apple-style-span"> if(</span>resolved_file<span class="Apple-style-span"> MATCHES "^<span class="Apple-style-span" style="border-collapse:collapse;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">/usr/X11/lib</span>")</span></div>
<div><span class="Apple-style-span"> message("resolving ${</span>resolved_file<span class="Apple-style-span">} as system")</span></div><div> set(${type_var} system PARENT_SCOPE)</div><div> endif()</div>
<div> endfunction()</div><div><br></div><div> include(BundleUtilities)</div><div><br></div><div> fixup_bundle( ... )</div><div><br></div><div>ParaView's install rules on the Mac do something like this, if you want to look at some example code.</div>
<div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div><div><br></div><div class="gmail_quote">On Mon, May 14, 2012 at 5:27 PM, Joe Ping-Lin Hsiao <span dir="ltr"><<a href="mailto:phsiao@cs.unc.edu" target="_blank">phsiao@cs.unc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks, this is exactly what I need.<br>
<br>
Just one question. Why the function gp_resolved_file_type_override()<br>
cannot be seen if it is implemented in my project's CMakeLists.txt? I<br>
have to add it in GetPrerequisite.cmake module, but that's not good.<br>
<br>
Thanks,<br>
Joe<br>
<div class="HOEnZb"><div class="h5"><br>
On Mon, May 7, 2012 at 11:04 AM, David Cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>> wrote:<br>
> /usr/X11/lib/libglut.dylib should probably be considered a "system<br>
> library" that is not included in your final bundle.<br>
><br>
> Therefore, all users of your application will have to have the Mac OS<br>
> X version of X installed and available in order to run your program.<br>
> (Is that all Macs nowadays anyway...?)<br>
><br>
> In order to classify it as a system library, you can provide a CMake<br>
> function named gp_resolved_file_type_override to look for that library<br>
> (probably anything starting with "/usr/X11/lib") and set its type to<br>
> "system" -- that will cause fixup_bundle to ignore it for copying and<br>
> fixup purposes.<br>
><br>
><br>
> HTH,<br>
> David<br>
><br>
><br>
> On Mon, May 7, 2012 at 10:57 AM, Joe Ping-Lin Hsiao <<a href="mailto:phsiao@cs.unc.edu">phsiao@cs.unc.edu</a>> wrote:<br>
>> Hi,<br>
>><br>
>> I use CMake to create an installer for a Mac program which uses GLUT.<br>
>> The GLUT library that the program links against with is<br>
>> /usr/X11/lib/libglut.dylib.<br>
>><br>
>> When I use fixup_bundle() to create an installer, I get the following<br>
>> error message:<br>
>><br>
>> install_name_tool: changing install names or rpaths can't be redone<br>
>> for: /Users/phsiao/dev/video/video_spot_tracker.app/Contents/MacOS/libglut.3.dylib<br>
>> (for architecture ppc7400) because larger updated load commands do not<br>
>> fit (the program must be relinked, and you may need to use -headerpad<br>
>> or -headerpad_max_install_names)<br>
>><br>
>> The first thing I tried was to add -headerpad_max_install_names and<br>
>> -headerpad to the linker flags, but no success. (Actually<br>
>> -headerpad_max_install_names already exists in CMakeFies/link.txt<br>
>> before I put it in.)<br>
>><br>
>> The next thing I tried was to add '-arch x86_64' to both CXX_FLAGS and<br>
>> LINKER_FLAGS to avoid fixup_bundle() to fix dependencies for<br>
>> architecture ppc7400, but the error remains.<br>
>><br>
>> Any idea how to get around this?<br>
>><br>
>> Thanks,<br>
>> Joe<br>
>> --<br>
>><br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br></div>