[CMake] Installing OSX Frameworks

Mike Jackson mike.jackson at imts.us
Wed Jul 23 11:39:31 EDT 2008



On Jul 23, 2008, at 11:32 AM, Shead, Timothy wrote:

> On 7/23/08 9:06 AM, "Mike Jackson" <mike.jackson at imts.us> wrote:
>
>> What should be happening is that your application should be linked
>> with libraries that have an "install_name" set to  
>> @execuatble_path/../
>> Frameworks...." or "@executable_path/../Dylibs/...." or something
>> along those lines. If your application is linked correctly then a
>> startup script is NOT needed at all as the application will
>> inherently "know" where to find the libraries.
>
> Agreed, this is the "right way".
>
>> CMake has support to set the "install_name" of a compiled library.
>> Brad King posted this to the list back in October of 2007:
>>
>> ==========================================
>> The default behavior is to make things runnable from the build tree.
>> You can force it to use your given install_name like this:
>>
>> ADD_LIBRARY(foo SHARED foo.c)
>> SET_TARGET_PROPERTIES(foo PROPERTIES
>>    INSTALL_NAME_DIR @executable_path/../Frameworks
>>    BUILD_WITH_INSTALL_RPATH 1
>>    )
>>
>> This is documented in the SET_TARGET_PROPERTIES command, though it  
>> may
>> not be clear that BUILD_WITH_INSTALL_RPATH applies to install_name  
>> too.
>
> I hadn't noticed this property, so thanks for the heads-up.   
> However, I
> believe there are two distinct requirements that have to be  
> addressed for
> bundles:
>
> 1) The executables and shared libraries you build yourself must be  
> linked
> correctly so they can locate their dependencies.

Yes. CMake should be able to take care of this for you.

> 2) Any third-party executables and shared libraries that you put in  
> your
> bundle must be linked correctly (or modified) so they can locate their
> dependencies (if any).
>
> INSTALL_NAME_DIR addresses the first case, but not the second - I  
> assume
> that that's where the home-grown stuff you mention fits in?
>

Yes. My own solution (involving a bash script that gets configured by  
CMake) can be found at <http://titanium.imts.us/viewvc/Task_7/ 
MXATools/Resources/OSX_Tools/>. The actual project is at <http:// 
titanium.imts.us/viewvc/Task_7/MXATools>.

Sorry, should have been more clear.


> Cheers,
> Tim
>
> --
> Timothy M. Shead
>


-- 
Mike Jackson



More information about the CMake mailing list