diff --git a/wscript b/wscript index c792a849e..9d835012c 100644 --- a/wscript +++ b/wscript @@ -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.