<div class="gmail_quote">On Tue, Jan 18, 2011 at 2:30 PM, Nick Kledzik <span dir="ltr"><<a href="mailto:kledzik@apple.com">kledzik@apple.com</a>></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 style="word-wrap: break-word;"><div class="im"><br><div><div>On Jan 18, 2011, at 11:23 AM, David Cole wrote:</div><blockquote type="cite"><span style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; font-size: medium;"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div>><br>> That is not entirely true....<br>><br>> Things like EXECUTABLE_OUTPUT_PATH and target location properties have<br>
> to work without an extra install step. What do you mean CMake expects<br>> to find things in install locations? CMake does need to be able to<br>> find executables after the build is run. It also needs to be able to<br>
> 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"<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 <build directory>/Debug and <build directory>/Release.<br>
<br>None of these locations are the "native" 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 "add_executable(main main.c)" naturally go?<br></span></blockquote></div><div><br></div></div>It depends on some global xcode settings. Some users have a one location in which all projects put their final projects. Some users have a build/Debug and build/Release directory next to the xcode project file. <div>
<br></div><div>That is why I'm thinking that if cmake's model is to have the final executable put into cmakes build directory, that I should just let xcode build it where the user wants, then copy it to where cmake wants. That way both models are happy.</div>
<div><br></div><font color="#888888"><div>-Nick</div><div><br><div><br></div><div><br></div><div><br></div></div></font></div></blockquote></div><br>CMake, unless told otherwise, should produce an identical build tree to the native tool when possible.<br>
<br>I think the way we do it now (by default) is a direct reflection of the fact that Xcode used to do it that way "back in the day"... when the Xcode generator was first produced. I don't think changing the default value of the output location is a problem for people.<br>
<br>But we do have to honor EXECUTABLE_OUTPUT_PATH and the new CMAKE_RUNTIME_OUTPUT_DIRECTORY and all of the variants thereof that people might be setting in their CMakeLists files.<br><br><br>