[CMake] Listing headers in source lists

Paul Smith paul at mad-scientist.net
Tue Jun 11 17:37:03 EDT 2013


This probably seems like a silly question but:

I've got a lot of "inherited" CMakefiles and I'm not a CMake expert by
any stretch.  In all these CMakeLists.txt files I see that whenever an
add_library or add_executable() macro is invoked, not only are the
source files (foo.cpp etc.) included in the list of files, but also all
the header files (foo.h etc.) are also included.

Is this necessary?  Assuming these are really base files and not
generated files, wouldn't CMake be able to handle the required header
file inclusion computations etc. so I wouldn't have to list them
explicitly?

Can anyone comment on this?

Thanks!



More information about the CMake mailing list