Reputation: 51
i have a project that has several header files. I want now to generate a header file that includes all project header files.
For example we have the following headers:
Now I want to generate a header file that includes all header files and looks approximately like that:
#include "a.h"
#include "b.h"
#include "c.h"
#include "ext/d.h"
Thanks for any kind of help.
Upvotes: 1
Views: 602
Reputation: 10195
file(GLOB_RECURSE header_files "include/*.h")
foreach(f ${header_files})
message("processing ${f}")
file(RELATIVE_PATH fr "${CMAKE_CURRENT_SOURCE_DIR}/include" ${f})
list(APPEND incls "#include \"${fr}\"\n")
endforeach()
file(WRITE mylibheader.h ${incls})
Description:
header_files
. Upvotes: 3