[CMake] xcode project and static library dependencies

David Cole david.cole at kitware.com
Tue Jan 18 14:35:47 EST 2011


On Tue, Jan 18, 2011 at 2:30 PM, Nick Kledzik <kledzik at apple.com> wrote:

>
> 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
>
>
>
>
>
CMake, unless told otherwise, should produce an identical build tree to the
native tool when possible.

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.

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110118/85ed6d5e/attachment-0001.htm>


More information about the CMake mailing list