[CMake] Mac Bundle installation with libraries

Michael Wild themiwi at gmail.com
Mon Mar 1 14:53:16 EST 2010


This would be solved by

http://www.cmake.org/Bug/view.php?id=10337

which allows you to override the decision whether a library is provided by the system or not.

Michael

On 1. Mar, 2010, at 20:29 , James Bigler wrote:

> Thanks, I didn't realize you could execute arbitrary cmake script during
> installation using install(CODE).  This module makes a lot more sense now.
> 
> Do you know of a way to get the tool to avoid certain libraries?
> 
> We depend on another package being installed as a driver component?  The
> libraries aren't installed into a default location, so BundleUtilities wants
> to install it, however the library shouldn't be bundled with the app.
> 
> James
> 
> On Fri, Feb 26, 2010 at 1:28 PM, Clinton Stimpson <clinton at elemtech.com>wrote:
> 
>> 
>> http://www.cmake.org/Wiki/BundleUtilitiesExample
>> I usually use it for 3rd party libraries, but it will also copy libraries
>> from
>> your build directory if you include your build directory in the list of
>> paths
>> to search in.
>> 
>> Clint
>> 
>> On Friday 26 February 2010 01:24:30 pm James Bigler wrote:
>>> How is that?  Could you provide a brief example of which function to
>> call?
>>> I looked through the code and wasn't sure what I could call since almost
>>> all the copies are done using execute_process which runs at configure
>>> time.
>>> 
>>> James
>>> 
>>> On Fri, Feb 26, 2010 at 1:12 PM, Clinton Stimpson
>> <clinton at elemtech.com>wrote:
>>>> Using BundleUtilities.cmake on each of the bundles should copy that
>>>> library into each bundle.
>>>> 
>>>> Clint
>>>> 
>>>> On Friday 26 February 2010 11:02:12 am James Bigler wrote:
>>>>> I have a project that builds a group of mac bundles that depend on a
>>>>> library I also compile.  I need to install the library within the
>>>>> bundle to get it to be relocatable, but I have no way of doing this
>>>>> without creating a circular dependency.
>>>>> 
>>>>> src/CMakeLists.txt:
>>>>> 
>>>>> add_subdirectory(mylib)
>>>>> add_subdirectory(mysamples)
>>>>> 
>>>>> src/mylib/CMakeLists.txt:
>>>>> 
>>>>> add_library(mylib mylib.cpp mylib.h)
>>>>> set_target_properties(mylib PROPERTIES VERSION "2.3.4" SOVERSION "1")
>>>>> install(TARGETS mylib RUNTIME DESTINATION bin LIBRARY DESTINATION lib
>>>>> ARCHIVE DESTINATION lib)
>>>>> 
>>>>> src/mysamples/CMakeLists.txt:
>>>>> 
>>>>> foreach(sample fun lessfun)
>>>>>  add_executable(${sample} ${sample}.cpp MACOSX_BUNDLE)
>>>>>  target_link_libraries(${sample} mylib)
>>>>> 
>>>>>  install(TARGETS ${sample} DESTINATION samples)
>>>>>  # I really want to install mylib in the bundle, but I don't have
>>>>> access to the library target anymore.
>>>>>  install(TARGETS mylib DESTINATION
>>>>> samples/${sample}.app/Contents/MacOS) endforeach()
>>>>> 
>>>>> I really want to install my library within the bundle, but I don't
>> have
>>>>> access to the library outside of the mylib subdirectory.  I can't
>>>>> create install targets in the mylib install directory, because I
>> don't
>>>>> have the list of bundles to install it to until after I parse the
>>>>> mysamples directory and it's too late.
>>>>> 
>>>>> I tried to use the LOCATION_${CMAKE_BUILD_CONFIG} variable, but
>> because
>>>> 
>>>> I'm
>>>> 
>>>>> using the VERSION and SOVERSION properties on my library I only get
>> one
>>>> 
>>>> of
>>>> 
>>>>> the symlinks and not all three (libmylib.dylib ->
>> libmylib.2.3.4.dylib,
>>>>> libmylib.1.dylib -> libmylib.2.3.4.dylib, and libmylib.2.3.4.dylib).
>>>>> 
>>>>> Is there some way I can get mylib to also install with my executable
>>>>> bundles?
>>>>> 
>>>>> James
>>> 
>> 
> _______________________________________________
> 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