[CMake] Generating include files

Urs Thuermann urs at isnogud.escape.de
Sat May 20 04:46:53 EDT 2017


Michael Ellery <mellery451 at gmail.com> writes:

> https://github.com/mellery451/gen_header
> 
> works for with me with makefile generator.

Yes, that's similar to what I have found yesterday after my posting.
It works but I'd prefer not to have to add the dependency to the
add_executable() specification.

I am new to cmake, but I still prefer standard make.  I work in a
project were I am supposed to use cmake, so I try to learn about it by
doing little examples.

But I find cmake makes simple things more complicated, it seems much
bigger and more complex than make and provides less flexibility.  I
prefer simple tools with simple basic primitives that can be combined
flexibly to build powerful systems.

I dislike that I should add tab.h as dependency to the executable
since it's actually the object file that depends on the header file.
The executable then only depends on the object file.

Say I have

	add_custom_command(output crctab.h command mkcrctab > crctab.h)
        add_executable(send send.c crc.c)
        add_executable(recv recv.c crc.c)
        add_executable(foo  foo.c  crc.c)

and crc.c does #include "crctab.h".  Would I then really have to add
crctab.h to all add_executable() specifications?  IMO the executables
shouldn't have to "know" how crc.c is implemented.  The just link
crc.o.        

urs


More information about the CMake mailing list