<div class="gmail_quote">On Tue, Jan 18, 2011 at 2:12 PM, Nick Kledzik <span dir="ltr">&lt;<a href="mailto:kledzik@apple.com">kledzik@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">On Jan 18, 2011, at 5:30 AM, Bill Hoffman wrote:<br>
&gt;&gt;&gt; I have changes that cause cmake to produce an Xcode project in which the<br>
&gt;&gt;&gt; targets do not have the extra phases, and the dependencies are set up such<br>
&gt;&gt;&gt; that incremental builds work efficiently!<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; But I&#39;m having some impedance mismatches between where Xcode want the<br>
&gt;&gt;&gt; build results to be and where cmake wants them.  Xcode (like many makefiles)<br>
&gt;&gt;&gt; has the concept of a normal build and an &quot;install&quot; build.  But when cmake<br>
&gt;&gt;&gt; runs it builds some test programs using the xcodebuild command line, but<br>
&gt;&gt;&gt; does not specify the &quot;install&quot; action but then expects to find the resulting<br>
&gt;&gt;&gt; executable in the install location.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I&#39;m sure I could change TryCompileCode() to add &quot;install&quot; to the<br>
&gt;&gt;&gt; xcodebuild line, but it seems like lots of other cmake scripts will have the<br>
&gt;&gt;&gt; same expectations.  I playing with trying to get Xcode to always do an<br>
&gt;&gt;&gt; &quot;install&quot;.  I tried creating xcode projects with the initial (not install)<br>
&gt;&gt;&gt; locations being where cmake wants them, but xcode seems to not do the<br>
&gt;&gt;&gt; internal dependency analysis properly when the intermediate results are not<br>
&gt;&gt;&gt; within BUILD_PRODUCTS_DIR.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; What is the cmake model for where the results of a build go?<br>
&gt;&gt;<br>
&gt;&gt; Putting the results where the native tool expects them is fine. CMake makes<br>
&gt;&gt; no guarantees about where build products go. If a native tool has no<br>
&gt;&gt; expectations, we try to hide build results underneath the &quot;CMakeFiles/&quot;<br>
&gt;&gt; directories in the build tree to avoid cluttering a developer&#39;s view of the<br>
&gt;&gt; build tree with stuff they mostly don&#39;t need to see...<br>
&gt;&gt; I don&#39;t think there are any hard requirements w.r.t. build products<br>
&gt;&gt; locations. Although where libraries and executables end up is important for<br>
&gt;&gt; the CMake generated install rules to work.<br>
&gt;&gt; Feel free to change things around experimentally if that makes it easy to<br>
&gt;&gt; work with newer Xcode versions. The test suite will very likely tell us if<br>
&gt;&gt; things have gone awry.<br>
&gt;&gt;<br>
&gt;<br>
&gt; That is not entirely true....<br>
&gt;<br>
&gt; Things like EXECUTABLE_OUTPUT_PATH and target location properties have<br>
&gt; to work without an extra install step. What do you mean CMake expects<br>
&gt; to find things in install locations?  CMake does need to be able to<br>
&gt; find executables after the build is run.  It also needs to be able to<br>
&gt; place them via location properties.<br>
<br>
<br>
</div></div>Take for example a simple test case that just builds one source file into an executable via&quot;<br>
  ADD_EXECUTABLE(main main.c)<br>
When I use cmake to create a Makefile, the resulting main executable is placed in the build directory tree next to the Makefile.<br>
When I use cmake to create a xcode project, the resulting main executable is placed  in a subdirectory named Debug of the build directory tree.<br>
<br>
The method cmCoreTryCompile::FindOutputFile() seems to know about this because it looks for executables in the build directory then in &lt;build directory&gt;/Debug and &lt;build directory&gt;/Release.<br>
<br>
None of these locations are the &quot;native&quot; location where Xcode would put a build result.  So, I need to create xcode projects that place/copy the resulting executables somewhere that cmake universe expects.<br>
<br>
Now I am wondering if I should add a copy-files-phase in the executable target to copy the resulting binary to the build directory.  That would make xcode output be like Makefile output.<br>
<font color="#888888"><br>
-Nick<br>
<br>
<br>
</font></blockquote></div><br>Where does the Xcode equivalent of &quot;add_executable(main main.c)&quot; naturally go?<br><br>