[CMake] Generating source file one step before linking

Johannes Bauer dfnsonfsduifb at gmx.de
Thu Jun 14 04:59:46 EDT 2012


Dear list,

I'd like to know if the following is possible: in my old buildsystem
(that I'm trying to convert to cmake) there is a script which runs just
before the linking stage. It examines the created objects and then
creates a source-file which needs to be linked in. The way this was done
before is something like this (pseudo-Makefile syntax):

execut: $(OBJS)
	./generate_code
	gcc $(LDFLAGS) $(OBJS) generated.c -o execut

.c.o:
	gcc -c blah


Is it possible to achieve something similar with cmake? I've read the
FAQ about generating code, but I do not know how to control the
dependencies (i.e. at which stage it is executed).

Best regards,
Johannes


More information about the CMake mailing list