aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-11-08 15:04:19 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2016-11-08 16:05:32 +0530
commit4d84241ccf515446b49ddbe19683184b5a4e5a13 (patch)
tree81f0580798e88c745ca298f5ab8f52564fdb5136 /mesonbuild/compilers.py
parentf6dfd362393fb1e999bcc0dbc7ef65c48d8b204f (diff)
downloadmeson-4d84241ccf515446b49ddbe19683184b5a4e5a13.zip
meson-4d84241ccf515446b49ddbe19683184b5a4e5a13.tar.gz
meson-4d84241ccf515446b49ddbe19683184b5a4e5a13.tar.bz2
has_header_symbol: Also detect C++ classes and templates
With the `using` keyword we can try to use the specified class or template which will tell us if it exists.
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r--mesonbuild/compilers.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index ce137cb..31cafa6 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -1059,6 +1059,20 @@ class CPPCompiler(CCompiler):
code = 'class breakCCompiler;int main(int argc, char **argv) { return 0; }\n'
return self.sanity_check_impl(work_dir, environment, 'sanitycheckcpp.cc', code)
+ def has_header_symbol(self, hname, symbol, prefix, env, extra_args=None, dependencies=None):
+ # Check if it's a C-like symbol
+ if super().has_header_symbol(hname, symbol, prefix, env, extra_args, dependencies):
+ return True
+ # Check if it's a class or a template
+ if extra_args is None:
+ extra_args = []
+ templ = '''{2}
+#include <{0}>
+using {1};
+int main () {{ return 0; }}'''
+ args = extra_args + self.get_compiler_check_args()
+ return self.compiles(templ.format(hname, symbol, prefix), env, args, dependencies)
+
class ObjCCompiler(CCompiler):
def __init__(self, exelist, version, is_cross, exe_wrap):
self.language = 'objc'