[CMake] qt .qrc file modifications require two builds

Clinton Stimpson clinton at elemtech.com
Wed Dec 16 23:17:42 EST 2009


On Dec 16, 2009, at 5:36 PM, David Cole wrote:

> On Wed, Dec 16, 2009 at 6:16 PM, Clinton Stimpson <clinton at elemtech.com> wrote:
> On Wednesday 16 December 2009 04:05:22 pm Brad King wrote:
> > Clinton Stimpson wrote:
> > > It looks like a bug in the Xcode generator.
> > > Here's an even simpler example:
> > >
> > > project(test_xcode)
> > >
> > > add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/test.h
> > >     COMMAND cp ${CMAKE_SOURCE_DIR}/test.h.in ${CMAKE_BINARY_DIR}/test.h
> > >     DEPENDS ${CMAKE_SOURCE_DIR}/test.h.in
> > >     )
> > >
> > > include_directories(${CMAKE_BINARY_DIR})
> > >
> > > add_executable(test_xcode
> > >     ${CMAKE_BINARY_DIR}/test.h
> > >     ${CMAKE_SOURCE_DIR}/test.h.in
> > >     main.cpp)
> > >
> > > I have to hit build twice if test.h.in is modified.
> >
> > This is a known limitation, and it is very hard to fix because
> > Xcode does not provide real custom command support.  It only
> > provides "shell script" build phases which we use to drive a
> > Makefile system that has the real custom commands.  Currently
> > the projects that CMake generates do not convince Xcode to
> > run the shell script build phase at the right time in all cases.
> >
> > See CMake's BuildDepends test:
> >
> >
> > http://www.cmake.org/cgi-bin/viewcvs.cgi/Tests/BuildDepends/CMakeLists.txt?
> >revision=1.14&root=CMake&view=markup
> >
> > Note the "HELP_XCODE" blocks.
> >
> > -Brad
> 
> What about adding a custom build phase and insert it before the "Compile
> Sources" build phase?
> 
> <http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/200-
> Build_Phases/bs_build_phases.html>
> 
> 
> Generated Xcode projects do use "Run Script" build phases... Perhaps there's a way we could specify input and output files for those build phases. Those bits of the UI seem to be empty when I inspect an Xcode project built from your "test.h.in" example here.


If I specify the input (path to test.h.in) & output (path to generated test.h) for the "CMake Rules" build phase, the problem goes away.
Maybe we can put all inputs and all outputs in there for generated files in that project?  The script (makefile) it calls already has the smarts for which ones really need updating.
Or is there a reason we can't just add a build phase for each add_custom_command() ?  Possibly too much clutter?

Clint

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


More information about the CMake mailing list