build: (fixes 2800) Add CXX standard to use; default to c++11

This commit is contained in:
Ryan Mast
2017-11-29 21:13:07 -08:00
parent 24691ee831
commit 9772db1705

11
wscript
View File

@@ -241,6 +241,9 @@ def options(opt):
help=('Log all events in a json file with the name of the executable (which must call CommandLine::Parse(argc, argv)'),
action="store_true", default=False,
dest='enable_desmetrics')
opt.add_option('--cxx-standard',
help=('Compile NS-3 with the given C++ standard'),
type='string', default='-std=c++11', dest='cxx_standard')
# options provided in subdirectories
opt.recurse('src')
@@ -445,8 +448,12 @@ def configure(conf):
conf.report_optional_feature("static", "Static build", False,
"Link flag -Wl,--whole-archive,-Bstatic does not work")
# Enable C++-11 support
env.append_value('CXXFLAGS', '-std=c++11')
# Enables C++-11 support by default, unless user specified another option
# Warn the user if the CXX Standard flag provided was not recognized
if conf.check_compilation_flag(Options.options.cxx_standard):
env.append_value('CXXFLAGS', Options.options.cxx_standard)
else:
Logs.warn("CXX Standard flag " + Options.options.cxx_standard + " was not recognized, using compiler's default")
# Set this so that the lists won't be printed at the end of this
# configure command.