This example demonstrates a minimalistic way of defining a custom CMake command.
#include <cmEngine/cmArgument.h>
#include <cmEngine/cmEngine.h>
#include <cmEngine/cmFunction.h>
#include <cmEngine/cmFunctionContext.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void
{
(void)custom_data;
for (;;) {
if (argument == NULL) {
break;
}
fwrite(content, 1, content_size, stdout);
fputc(' ', stdout);
}
}
static void
defineEchoCommand(
struct cmEngine* engine)
{
memset(&echo_function, 0, sizeof(echo_function));
echo_function.
call = callEchoCommand;
}
int
main(int argc, const char** argv)
{
defineEchoCommand(engine);
for (int i = 1; i < argc; i++) {
int err =
cmOpen(engine, argv[i]);
if (err != 0) {
return EXIT_FAILURE;
}
}
return EXIT_SUCCESS;
}