-
Notifications
You must be signed in to change notification settings - Fork 0
/
cxx11.py
31 lines (26 loc) · 949 Bytes
/
cxx11.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /usr/bin/env python
# encoding: utf-8
def configure(conf):
def get_param(varname,default):
return getattr(Options.options,varname,'')or default
cxx11_fragment="int main() { enum class color {red, blue};}"
flags=['-std=c++11','-std=c++0x']
if conf.options.cxx11_flag:
flags=[conf.options.cxx11_flag]
found_cxx11=False
for flag in flags:
try:
conf.check_cxx(msg="Checking C++ 11 flag " + flag,
fragment=cxx11_fragment,
cxxflags=flag, linkflags=flag, uselib_store='cxx11')
except conf.errors.ConfigurationError:
continue
else:
found_cxx11=True
break
if not found_cxx11:
conf.fatal('Could not find C++ 11 flag')
def options(opt):
cxx11=opt.add_option_group('C++ 11 Options')
cxx11.add_option('--cxx11-flag',
help='Flag to enable C++ 11')