<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Dec 16, 2009, at 5:36 PM, David Cole wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Wed, Dec 16, 2009 at 6:16 PM, Clinton Stimpson <span dir="ltr">&lt;<a href="mailto:clinton@elemtech.com">clinton@elemtech.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Wednesday 16 December 2009 04:05:22 pm Brad King wrote:<br>
&gt; Clinton Stimpson wrote:<br>
&gt; &gt; It looks like a bug in the Xcode generator.<br>
&gt; &gt; Here's an even simpler example:<br>
&gt; &gt;<br>
&gt; &gt; project(test_xcode)<br>
&gt; &gt;<br>
&gt; &gt; add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/test.h<br>
&gt; &gt; &nbsp; &nbsp; COMMAND cp ${CMAKE_SOURCE_DIR}/<a href="http://test.h.in/" target="_blank">test.h.in</a> ${CMAKE_BINARY_DIR}/test.h<br>
&gt; &gt; &nbsp; &nbsp; DEPENDS ${CMAKE_SOURCE_DIR}/<a href="http://test.h.in/" target="_blank">test.h.in</a><br>
&gt; &gt; &nbsp; &nbsp; )<br>
&gt; &gt;<br>
&gt; &gt; include_directories(${CMAKE_BINARY_DIR})<br>
&gt; &gt;<br>
&gt; &gt; add_executable(test_xcode<br>
&gt; &gt; &nbsp; &nbsp; ${CMAKE_BINARY_DIR}/test.h<br>
&gt; &gt; &nbsp; &nbsp; ${CMAKE_SOURCE_DIR}/<a href="http://test.h.in/" target="_blank">test.h.in</a><br>
&gt; &gt; &nbsp; &nbsp; main.cpp)<br>
&gt; &gt;<br>
&gt; &gt; I have to hit build twice if <a href="http://test.h.in/" target="_blank">test.h.in</a> is modified.<br>
&gt;<br>
&gt; This is a known limitation, and it is very hard to fix because<br>
&gt; Xcode does not provide real custom command support. &nbsp;It only<br>
&gt; provides "shell script" build phases which we use to drive a<br>
&gt; Makefile system that has the real custom commands. &nbsp;Currently<br>
&gt; the projects that CMake generates do not convince Xcode to<br>
&gt; run the shell script build phase at the right time in all cases.<br>
&gt;<br>
&gt; See CMake's BuildDepends test:<br>
&gt;<br>
&gt;<br>
&gt; <a href="http://www.cmake.org/cgi-bin/viewcvs.cgi/Tests/BuildDepends/CMakeLists.txt" target="_blank">http://www.cmake.org/cgi-bin/viewcvs.cgi/Tests/BuildDepends/CMakeLists.txt</a>?<br>
&gt;revision=1.14&amp;root=CMake&amp;view=markup<br>
&gt;<br>
&gt; Note the "HELP_XCODE" blocks.<br>
&gt;<br>
&gt; -Brad<br>
<br>
</div></div>What about adding a custom build phase and insert it before the "Compile<br>
Sources" build phase?<br>
<br>
&lt;<a href="http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/200-Build_Phases/bs_build_phases.html" target="_blank">http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/200-<br>
Build_Phases/bs_build_phases.html</a>&gt;<br><br></blockquote><div><br></div><div>Generated Xcode projects do use "Run Script"&nbsp;build phases... Perhaps there's a way we could specify input and output files for those build phases. Those bits of the UI seem to be empty when I inspect an Xcode project built from your "<a href="http://test.h.in/">test.h.in</a>" example here.</div></div></blockquote><div><br></div><div><br></div><div>If I specify the input (path to test.h.in) &amp; output (path to generated test.h) for the "CMake Rules" build phase, the problem goes away.</div><div>Maybe we can put all inputs and all outputs in there for generated files in that project? &nbsp;The script (makefile) it calls already has the smarts for which ones really need updating.</div><div>Or is there a reason we can't just add a build phase for each add_custom_command() ? &nbsp;Possibly too much clutter?</div><div><br></div><div>Clint</div><div><br></div></div></body></html>