[CMake] Generating include files
Urs Thuermann
urs at isnogud.escape.de
Fri May 19 16:00:21 EDT 2017
How can I write a CMakeFile that will include a generated source file
into another C source? I have read the FAQ, searched the mailing list
archives and have tried for two hours without success.
With standard make this would be quite simple:
$ cat Makefile
foo: foo.o
foo.o: tab.c
tab.c:
awk -f mktab > $@
$ cat foo.c
#include "tab.c"
int main() { return tab[0]; }
$ cat mktab
#!/usr/bin/awk
BEGIN{ print "static int tab[] = { 0, 1, 2 };"; exit }
$ make
awk -f mktab > tab.c
cc -c -o foo.o foo.c
cc foo.o -o foo
$
How would I do this with cmake?
urs
More information about the CMake
mailing list