[CMake] XCode, CMAKE_CFG_INTDIR, and add_custom_command

Tyler Roscoe tyler at cryptio.net
Fri Sep 4 13:59:48 EDT 2009


On Fri, Sep 04, 2009 at 11:09:18AM -0600, James Bigler wrote:
> > So when I compile a regular C file, XCode puts the resulting object file
> > here:
> >
> > /code/myproj/src/MyProj.build/Debug/mytarget.build/Objects-normal/i386/main.o
> >
> > When I try to compile something else to an object file using an
> > add_custom_command and CMAKE_CFG_INTDIR I get this path:
> >
> > ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/myfile.o ->
> > /code/myproj/src/Debug/myfile.o
> >
> > The I run into problem of the directory /code/myproj/src/Debug/ not
> > existing.
> >
> > So I have two choices.
> >
> > 1. Add the directory creation to the custom command.
> > 2. Figure out how to get a path that actually exists.

Can you mark myfile.o as GENERATED? I don't remember if this works for
custom_commands.

cmake -E make_directory /path/to/objectdir ought to work though I agree
that's hacky.

Because of problems like yours, I've decided that
defer-build-type-until-the-user-tells-the-IDE-what-build-type-to-build
is pretty much the worst thing that has ever happened to build
engineering :).

tyler


More information about the CMake mailing list