aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-04-28 14:37:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-04-28 14:37:47 +0200
commitb337a810939559ed8ee49c77f9918e5be76dd7b9 (patch)
tree839e01403dcb67b796ad3e90fc4973a8a59d775b
parent0fab09e0a93dcb52e5e010512ec96d70561443aa (diff)
Improve version check
-rw-r--r--build2/version/rule.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/build2/version/rule.cxx b/build2/version/rule.cxx
index 6909b92..6632d55 100644
--- a/build2/version/rule.cxx
+++ b/build2/version/rule.cxx
@@ -453,9 +453,16 @@ namespace build2
string r;
- r += "#if !(" + cond () + ")\n";
- r += "# error incompatible " + n + " version, ";
- r += n + ' ' + c.string () + " is required\n";
+ // This is tricky: if the version header hasn't been generated yet,
+ // then the check will fail. Maybe a better solution is to disable
+ // diagnostics and ignore (some) errors during dependency
+ // extraction.
+ //
+ r += "#ifdef " + vm + "\n";
+ r += "# if !(" + cond () + ")\n";
+ r += "# error incompatible " + n + " version, ";
+ r += n + ' ' + c.string () + " is required\n";
+ r += "# endif\n";
r += "#endif";
return r;