[CMake] XCode, CMAKE_CFG_INTDIR, and add_custom_command

David Cole david.cole at kitware.com
Fri Sep 4 14:07:50 EDT 2009


It should be fairly easy to add a 2nd custom command that creates the
directory and writes out a stamp file and then make your 1st custom command
depend on the stamp file.
I would go with that approach and put stuff where you want it rather than
trying to figure out where all the varied generators put things...


On Fri, Sep 4, 2009 at 12:10 AM, James Bigler <jamesbigler at gmail.com> 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.
>
> What is the preferred method, and does anyone have hints of how to get an
> actual build path for XCode?
>
> It's too bad that add_custom_command doesn't detect that the path to the
> output file doesn't exist and make it for me. ;)
>
> Thanks,
> James
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090904/59387907/attachment.htm>


More information about the CMake mailing list