![]() |
TCM 1.1.0
A CMake module to reduce boilerplate
|
TCM provides a single function for defining standalone examples.
All source files will be compiled as a target You shouldn't use it for "complex" examples, where some .cpp files do not provide a main entry point.
<relative_path_to_examples_folder>_filename
If WITH_BENCHMARK
is passed, then each example will be added to default target ${PROJECT_NAME}_Benchmarks
. For this to work, some source manipulation is done. A new source file is created, where the entry point, main()
, (must take no arguments !) is replaced to a standalone function. The new source file call the newly function inside a benchmarkable boilerplate.
If LIBRARIES
is set to a library target (interface or not), then each example will link to it. If this is not enough, each call to tcm_examples
will produce a list of targets TCM_EXAMPLES_TARGET
. You can iterate through it and manually set properties.
Full example available at tests/examples
.