[CMake] xcode project and static library dependencies

Nick Kledzik kledzik at apple.com
Tue Jan 18 14:30:43 EST 2011


On Jan 18, 2011, at 11:23 AM, David Cole wrote:
> >
> > That is not entirely true....
> >
> > Things like EXECUTABLE_OUTPUT_PATH and target location properties have
> > to work without an extra install step. What do you mean CMake expects
> > to find things in install locations?  CMake does need to be able to
> > find executables after the build is run.  It also needs to be able to
> > place them via location properties.
> 
> 
> Take for example a simple test case that just builds one source file into an executable via"
>  ADD_EXECUTABLE(main main.c)
> When I use cmake to create a Makefile, the resulting main executable is placed in the build directory tree next to the Makefile.
> 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.
> 
> 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.
> 
> 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.
> 
> 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.
> 
> -Nick
> 
> 
> 
> Where does the Xcode equivalent of "add_executable(main main.c)" naturally go?


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.  

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.

-Nick




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110118/adcb7c5e/attachment.htm>


More information about the CMake mailing list