On Mon, Mar 8, 2010 at 6:28 PM, Tony Bridges <nabrid...@gmail.com> wrote: > Hi All, > > The problem is : the files that are generated are not dependencies of the > top level target (as discussed in the article), they are dependencies of > another source file because they are generated includes. If I add the > dependency to the executable, there’s no guarantee that the order will be > correct, from what I see. >
I think pretty much dependencies are handled in-order... unless there is something specifically that requires something else before the first thing. > > > i.e. > > message compiler runs in directory A, produces a .txt output containing > string definitions. > > Generated file is included into an RC file in directory B, within the > correct RC context. > > > > The piece I’m missing is how to hook a source file as a top level target, > without having to reimplement the compilation phase as a custom rule. > it does seem that sources are not targets... but the target they are built into can depend on other targets, which get built before sources are compiled? > > > The makefile equivalent of all this is very simply : > > myResource.rc : externalGeneratedFile.txt > > > > This feels like fairly common usage, so I’m sure I’ve just missed something, > but I’m not sure what. > > many thanks > I was just playing with this... cmake_minimum_required(VERSION 2.8) set( FAKE source.h ) #this would be text->.h add_custom_command( OUTPUT source.h #DEPENDS ${SACK_BASE}/all_resources.rc COMMAND echo \#include \"stdio.h\" >source.h ) # this would be .h used by add_custom_command( OUTPUT main.c DEPENDS source.h COMMAND echo int main( void ) { return 1\; } >main.c ) ADD_CUSTOM_TARGET( generate_foo DEPENDS main.c ) # have to touch filea.c fileb.c and filec.c yourself... for brevity... set( SOURCES main.c filea.c fileb.c filec.c ) add_executable( main ${SOURCES} ) # this pretty much makes sure that the header is generated before other tings are compiled. add_dependencies( main generate_foo ) # output after a make clean... [ 0%] Generating source.h [ 0%] Generating main.c [ 25%] Built target generate_foo [ 37%] Building C object CMakeFiles/main.dir/main.c.obj [ 50%] Building C object CMakeFiles/main.dir/a.c.obj [ 62%] Building C object CMakeFiles/main.dir/b.c.obj [ 75%] Building C object CMakeFiles/main.dir/c.c.obj Linking C executable main.exe [100%] Built target main # next output... M:\tmp\zz\zz>make [ 25%] Built target generate_foo [100%] Built target main > /t > > _______________________________________________ > 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 > _______________________________________________ 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