SCons: Set explicit standards to C++98 and C11
For GCC the 2.1 branch only supports up to GCC 5, which defaulted to those versions. Trying to build with modern Clang (thus bypassing the GCC version check) fails because the code is not C++17 compliant.
This commit is contained in:
15
SConstruct
15
SConstruct
@ -295,10 +295,23 @@ if selected_platform in platform_list:
|
||||
# must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
|
||||
detect.configure(env)
|
||||
|
||||
# Set our C and C++ standard requirements.
|
||||
# Prepending to make it possible to override.
|
||||
is_msvc = os.name == "nt" and os.getenv("VCINSTALLDIR") and (platform_arg == "windows" or platform_arg == "uwp")
|
||||
if (not is_msvc):
|
||||
# Specifying GNU extensions support explicitly, which are supported by both GCC and Clang.
|
||||
# We don't support C++17 so stick to earlier standards.
|
||||
# When 2.1 was actively worked on, we were using GCC 5 which defaults to C++98, so use that.
|
||||
env.Prepend(CFLAGS=["-std=gnu11"])
|
||||
env.Prepend(CXXFLAGS=["-std=gnu++98"])
|
||||
else:
|
||||
# MSVC doesn't support setting C++ to pre-C++14 standards, so do nothing and hope it works.
|
||||
pass
|
||||
|
||||
if (env["warnings"] == 'yes'):
|
||||
print("WARNING: warnings=yes is deprecated; assuming warnings=all")
|
||||
|
||||
if (os.name == "nt" and os.getenv("VCINSTALLDIR") and (platform_arg == "windows" or platform_arg == "uwp")): # MSVC, needs to stand out of course
|
||||
if (is_msvc): # MSVC
|
||||
disable_nonessential_warnings = ['/wd4267', '/wd4244', '/wd4305', '/wd4800'] # Truncations, narrowing conversions...
|
||||
if (env["warnings"] == 'extra'):
|
||||
env.Append(CCFLAGS=['/Wall']) # Implies /W4
|
||||
|
||||
Reference in New Issue
Block a user