summaryrefslogtreecommitdiff
path: root/make/directive.pm
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-10-04 14:16:25 +0200
committerPeter Powell <petpow@saberuk.com>2018-10-04 14:17:02 +0200
commit8e3aaf1ff00968f413bcac714d79728a831899fd (patch)
tree5eebe82e9c7f62a2a567d437569016d864d5523a /make/directive.pm
parent479d0d9de4fe169deb96d12bd1379246aa498493 (diff)
Add a directive for requiring a specific compiler.
Diffstat (limited to 'make/directive.pm')
-rw-r--r--make/directive.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/make/directive.pm b/make/directive.pm
index b178228fd..ef6bb1bf5 100644
--- a/make/directive.pm
+++ b/make/directive.pm
@@ -222,6 +222,22 @@ sub __function_find_linker_flags {
__error $file, "unable to find the <|GREEN $name|> linker flags for <|GREEN ${\basename $file, '.cpp'}|>!";
}
+sub __function_require_compiler {
+ my ($file, $name, $minimum, $maximum) = @_;
+
+ # Look up information about the compiler.
+ return undef unless $ENV{CXX};
+ my %compiler = get_compiler_info($ENV{CXX});
+
+ # Check whether the current compiler is suitable.
+ return undef unless $compiler{NAME} eq $name;
+ return undef if defined $minimum && $compiler{VERSION} < $minimum;
+ return undef if defined $maximum && $compiler{VERSION} > $maximum;
+
+ # Requirement directives don't change anything directly.
+ return "";
+}
+
sub __function_require_system {
my ($file, $name, $minimum, $maximum) = @_;
my ($system, $version);