diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-06-20 19:02:46 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-06-20 19:02:46 +0200 |
commit | 4bc1ac3fe2fe3ae96ba0e5aa4d19fa4885a16c83 (patch) | |
tree | 7508c9420134fe4be54d1b42949f6a9b9c08236b /libcppbuild.h | |
parent | 29108531a0569f0a77834b5cc49aeac128cbfd64 (diff) |
Add convenience macro for registering build config call-backs.
Diffstat (limited to 'libcppbuild.h')
-rw-r--r-- | libcppbuild.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libcppbuild.h b/libcppbuild.h index 5b442f8..2aba987 100644 --- a/libcppbuild.h +++ b/libcppbuild.h @@ -27,3 +27,9 @@ struct BuildConfiguration using BuildConfigurations = std::vector<BuildConfiguration>; int reg(const char* location, BuildConfigurations (*cb)()); + +// Convenience macro - ugly but keeps things simple(r) +#define CONCAT(a, b) CONCAT_INNER(a, b) +#define CONCAT_INNER(a, b) a ## b +#define UNIQUE_NAME(base) CONCAT(base, __LINE__) +#define REG(cb) namespace { int UNIQUE_NAME(unique) = reg(__FILE__, cb); } |