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.<br>

<br><span style="font-family: courier new,monospace;">src/CMakeLists.txt:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">add_subdirectory(mylib)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">add_subdirectory(mysamples)</span><br style="font-family: courier new,monospace;"></div><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">src/mylib/CMakeLists.txt:</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">add_library(mylib mylib.cpp mylib.h)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">set_target_properties(mylib PROPERTIES VERSION &quot;2.3.4&quot; SOVERSION &quot;1&quot;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">install(TARGETS mylib RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)</span><br style="font-family: courier new,monospace;">

</div><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">src/mysamples/CMakeLists.txt:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">

<div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">foreach(sample fun lessfun)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  add_executable(${sample} ${sample}.cpp MACOSX_BUNDLE)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  target_link_libraries(${sample} mylib)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  install(TARGETS ${sample} DESTINATION samples)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  # I really want to install mylib in the bundle, but I don&#39;t have access to the library target anymore.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  install(TARGETS mylib DESTINATION samples/${sample}.app/Contents/MacOS)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">endforeach()</span><br style="font-family: courier new,monospace;"></div><br>I really want to install my library within the bundle, but I don&#39;t have access to the library outside of the mylib subdirectory.  I can&#39;t create install targets in the mylib install directory, because I don&#39;t have the list of bundles to install it to until after I parse the mysamples directory and it&#39;s too late.<br>

<br>I tried to use the LOCATION_${CMAKE_BUILD_CONFIG} variable, but because I&#39;m using the VERSION and SOVERSION properties on my library I only get one of the symlinks and not all three (libmylib.dylib -&gt; libmylib.2.3.4.dylib, libmylib.1.dylib -&gt; libmylib.2.3.4.dylib, and libmylib.2.3.4.dylib).<br>

<br>Is there some way I can get mylib to also install with my executable bundles?<br><br>James<br>