Include project version in examplevm

This commit is contained in:
Paweł Bylica 2018-08-28 21:14:32 +02:00 committed by Alex Beregszaszi
parent 8726fc9a33
commit a777a13f87
2 changed files with 8 additions and 1 deletions

View File

@ -12,6 +12,7 @@ set_target_properties(
RUNTIME_OUTPUT_DIRECTORY .. RUNTIME_OUTPUT_DIRECTORY ..
LIBRARY_OUTPUT_DIRECTORY .. LIBRARY_OUTPUT_DIRECTORY ..
) )
set_source_files_properties(examplevm.c PROPERTIES COMPILE_DEFINITIONS PROJECT_VERSION=${PROJECT_VERSION})
install( install(
TARGETS evmc-examplevm TARGETS evmc-examplevm

View File

@ -5,6 +5,12 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#define STR(x) #x
#if !defined(PROJECT_VERSION)
#define PROJECT_VERSION 0.0.0
#endif
struct examplevm struct examplevm
{ {
struct evmc_instance instance; struct evmc_instance instance;
@ -129,7 +135,7 @@ struct evmc_instance* evmc_create_examplevm()
struct evmc_instance init = { struct evmc_instance init = {
.abi_version = EVMC_ABI_VERSION, .abi_version = EVMC_ABI_VERSION,
.name = "examplevm", .name = "examplevm",
.version = "0.0.0", .version = STR(PROJECT_VERSION),
.destroy = destroy, .destroy = destroy,
.execute = execute, .execute = execute,
.set_option = set_option, .set_option = set_option,