[CMake] Generated source files and dependencies(+) (Wojciech Migda)

Clinton Stimpson clinton at elemtech.com
Tue Sep 8 16:56:15 EDT 2009


On Tuesday 08 September 2009 02:14:45 pm Wojciech Migda wrote:
> > Why not include it in the foo target, instead of making a new
>
> a_h_gen target and doing extra dependencies manually?
>
> Firstly, we have hundred of source files which may indirectly depend
> generated source files, so we want such information to be covered by
> cmake dependency scanner itself - the problem is that there is no link
> between the library target and the header target.

That's why I suggested
ADD_LIBRARY(foo STATIC a.c ${CMAKE_CURRENT_BINARY_DIR}/a.h)

It creates the generated headers for foo, then does the dependency scanning 
for foo, then compiles files.

Here's what I got:
$ make
[ 50%] Generating a.h
Scanning dependencies of target foo
[100%] Building C object CMakeFiles/foo.dir/a.o
Linking C static library libfoo.a

If that doesn't work for your case, can you be more specific on why it doesn't?

Clint

>
> By no means we want to specify such dependencies manually - that would
> be a nightmare.
>
> If we skip the a_h_gen target the header generation target will not
> appear in Makefile2, which I think is one of the required links for
> everything to work. The last remaining link is missing (which we may
> mimic by hand with the add_dependencies command) by I don't know how
> to fix it so it becomes automatic within the build system and
> dependency scanner.
>
> -Wojciech
>
>
>
> ----------------------------------------------------------------------
> Marcin Gortat – gwiazda NBA w naszej reprezentacji!
> Czytaj wiecej >> http://link.interia.pl/f232a
>
> _______________________________________________
> 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



More information about the CMake mailing list