Please keep follow-up questions on list, so others may participate and benefit as well.<br><br><div>The Framework test demonstrates one (not pretty, not elegant, but possible) way to do what you want.</div><div><br></div><div>
Rather than using PUBLIC_HEADER to achieve the final location of the nested header file, use the source file property MACOSX_PACKAGE_LOCATION.</div><div><br></div><div><div>add_library(foo SHARED</div><div>  foo.cxx</div>
<div>  ...</div><div>  fooDeepPublic.h</div><div>)</div><div>set_property(SOURCE fooDeepPublic.h</div><div>  PROPERTY MACOSX_PACKAGE_LOCATION Headers/Deep</div><div>  )</div><div><br></div><div><br></div><div>The result of the foo.framework build on my Mac CMake build tree is as follows:</div>
<div><div><br></div><div>davidcole@mymac : foo.framework </div><div>$ pwd</div><div>&lt;&lt;...&gt;&gt;/CMake Mac-unix-Debug/Tests/Framework/foo.framework</div><div><br></div><div>davidcole@mymac : foo.framework </div><div>
$ find .</div><div>.</div><div>./foo</div><div>./Headers</div><div>./PrivateHeaders</div><div>./Resources</div><div>./Versions</div><div>./Versions/Current</div><div>./Versions/ver4</div><div>./Versions/ver4/foo</div><div>
./Versions/ver4/Headers</div><div>./Versions/ver4/Headers/Deep</div><div><b>./Versions/ver4/Headers/Deep/fooDeepPublic.h</b></div><div>./Versions/ver4/Headers/foo.h</div><div>./Versions/ver4/Headers/foo2.h</div><div>./Versions/ver4/Headers/fooPublic.h</div>
<div>./Versions/ver4/Headers/fooPublicExtensionlessHeader</div><div>./Versions/ver4/PrivateHeaders</div><div>./Versions/ver4/PrivateHeaders/fooBoth.h</div><div>./Versions/ver4/PrivateHeaders/fooPrivate.h</div><div>./Versions/ver4/PrivateHeaders/fooPrivateExtensionlessHeader</div>
<div>./Versions/ver4/Resources</div><div>./Versions/ver4/Resources/fooExtensionlessResource</div><div>./Versions/ver4/Resources/Info.plist</div><div>./Versions/ver4/Resources/test.lua</div></div><div><br></div><div><br></div>
<div>HTH,</div><div>David</div><div><br></div><div><br></div><div class="gmail_quote">On Tue, Oct 19, 2010 at 8:26 AM, Daniel Pfeifer <span dir="ltr">&lt;<a href="mailto:daniel@pfeifer-mail.de">daniel@pfeifer-mail.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi David,<br>
<br>
Am Freitag, den 15.10.2010, 10:42 -0400 schrieb David Cole:<br>
<div class="im">&gt; The best way to preserve structure is to layout the source directory<br>
&gt; exactly as you want it, and then use a single install(DIRECTORY<br>
&gt; command. If it&#39;s not in your source tree exactly as you want it, you<br>
&gt; could add a custom build step to arrange such a directory in your<br>
&gt; build tree, and then use install(DIRECTORY on that.<br>
&gt;<br>
&gt; An alternative would be to group headers that go together using<br>
&gt; variables, one per destination directory, and then have one<br>
&gt; install(FILES rule for each separate destination directory.<br>
<br>
</div>Right, for the install(FILES) command there are a few alternatives.<br>
But what about the PUBLIC_HEADER property for mac frameworks?<br>
<div><div></div><div class="h5"><br>
&gt; HTH,<br>
&gt; David<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Fri, Oct 15, 2010 at 7:00 AM, Daniel Pfeifer<br>
&gt; &lt;<a href="mailto:daniel@pfeifer-mail.de">daniel@pfeifer-mail.de</a>&gt; wrote:<br>
&gt;         Hi,<br>
&gt;<br>
&gt;         This question has been asked quite a few times, but never<br>
&gt;         satisfactorily<br>
&gt;         answerded before: How do I install a bunch of headers<br>
&gt;         preserving<br>
&gt;         directory structure? The following snippet<br>
&gt;<br>
&gt;         &gt; set(HEADERS header1.h dir/header2.h)<br>
&gt;         &gt; install(FILES ${HEADERS} DESTINATION include)<br>
&gt;<br>
&gt;         puts both files inside the same directory. The structure is<br>
&gt;         not<br>
&gt;         preserved. The following workaround does the trick:<br>
&gt;<br>
&gt;         &gt; foreach(HEADER HEADERS)<br>
&gt;         &gt;   string(REGEX MATCH &quot;(.*)[/\\]&quot; DIR ${HEADER})<br>
&gt;         &gt;   install(FILES ${HEADER} DESTINATION include/${DIR})<br>
&gt;         &gt; endforeach(HEADER HEADERS)<br>
&gt;<br>
&gt;         However, I consider this as a workaround, not as a solution!<br>
&gt;<br>
&gt;         It gets more complicated as soon as I want to build frameworks<br>
&gt;         on mac,<br>
&gt;<br>
&gt;         &gt; set_target_properties(my_lib PROPERTIES PUBLIC_HEADER<br>
&gt;         ${HEADERS})<br>
&gt;<br>
&gt;         again puts both files inside the same directory, ignoring<br>
&gt;         structure.<br>
&gt;         Here the workaround is even less a solution, if this is really<br>
&gt;         the only<br>
&gt;         way:<br>
&gt;         &lt;<a href="http://www.cmake.org/pipermail/cmake/2008-June/022378.html" target="_blank">http://www.cmake.org/pipermail/cmake/2008-June/022378.html</a>&gt;<br>
&gt;<br>
&gt;         Hasn&#39;t this been considered before? The public wiki shows two<br>
&gt;         use cases<br>
&gt;         of cmake frameworks, but neither of them puts headers into a<br>
&gt;         directory<br>
&gt;         hierarchy. &lt;<a href="http://www.cmake.org/Wiki/CMake:MacOSX_Frameworks" target="_blank">http://www.cmake.org/Wiki/CMake:MacOSX_Frameworks</a>&gt;<br>
&gt;<br>
&gt;         cheers, Daniel<br>
&gt;<br>
&gt;<br>
&gt;         _______________________________________________<br>
&gt;         Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt;         Visit other Kitware open-source projects at<br>
&gt;         <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt;         Please keep messages on-topic and check the CMake FAQ at:<br>
&gt;         <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
&gt;<br>
&gt;         Follow this link to subscribe/unsubscribe:<br>
&gt;         <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
&gt;<br>
&gt;<br>
<br>
<br>
</div></div></blockquote></div><br></div>