I am currently in the process of writing a Utility Library that will ship with a pre-compiled DLL file and the header files of the library. As of now, there are a whole bunch of header files, but I would like to compile all of them into a single header file (somewhat like pre-processing only the #include
directives).
I was wondering, if and how such a generation would be possible using CMake.
Sincerely, Lehks
These tools are not specific to CMake, but can be invoked inside CMake.
I recently collected together some links to create a single-header release for ApprovalTests.cpp.
I initially recorded them in a comment on an issue in podsiadly/ImageApprovals: this answer is to make that info easier to share.
Options:
inline
to the output, or putting all the code from .cpp files into one location in the output, this is compiled only once.
CATCH_CONFIG_MAIN
works, for example.inline
.cpp
filesinline
to some functions from .cpp: has a (customisable) convention for putting inline_t
in your source code, for where inline
should be included in the generated header#include
lines, and various template mark-up, Pragmas and so-on.cpp
files?inline
// ~*~* CATCH_CPP_STITCH_PLACE *~*~
- which it finds in include/internal/catch_impl.hpp, and pastes all .cpp files in, in alphabetical order#include
s (in preprocess_file
)a.hpp
includes b.hpp
then b.hpp
will be processed first, SingleHeaderGen.generate
) #ifdef/#endif
.ImageApprovals_IMPLEMENT
is defined .cpp
files.cpp
filesIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With