Skip to content

Commit e9c2ea9

Browse files
authored
Merge pull request #47 from baconpaul/version-stuff
A proposal for version check in clap-helpers
2 parents a34ba6c + 7450efe commit e9c2ea9

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

include/clap/helpers/host.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include <clap/clap.h>
66

7+
#include "version-check.hh"
8+
79
#include "checking-level.hh"
810
#include "misbehaviour-handler.hh"
911

include/clap/helpers/plugin.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
#include <clap/all.h>
1111

12+
#include "version-check.hh"
13+
1214
#include "checking-level.hh"
1315
#include "host-proxy.hh"
1416
#include "misbehaviour-handler.hh"

include/clap/helpers/version-check.hh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#pragma once
2+
3+
/*
4+
* Check the clap version against the supported versions for this version of CLAP Helpers.
5+
* It defines two clap versions, a min and max version, and static asserts that the CLAP
6+
* we are using is in range.
7+
*
8+
* Workflow wise, if you are about to make clap-helpers incompatible with a version, set
9+
* the prior version to max, commit and push, and then move the min to current and max to 2 0 0
10+
* again.
11+
*/
12+
13+
#include "clap/version.h"
14+
15+
#if CLAP_VERSION_LT(1,2,0)
16+
static_assert(false, "Clap version must be at least 1.2.0")
17+
#endif
18+
19+
#if CLAP_VERSION_GE(2,0,0)
20+
static_assert(false, "Clap version must be at most 1.x")
21+
#endif

0 commit comments

Comments
 (0)