Skip to content

Commit c699040

Browse files
committed
Add option to specify the desired C++ standard
1 parent 86d6e94 commit c699040

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tools/default_flags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def exists(env):
2828
def generate(env):
2929
# Require C++17
3030
if env.get("is_msvc", False):
31-
env.Append(CXXFLAGS=["/std:c++17"])
31+
env.Append(CXXFLAGS=["/std:" + env["cpp_standard"]])
3232
else:
33-
env.Append(CXXFLAGS=["-std=c++17"])
33+
env.Append(CXXFLAGS=["-std=" + env["cpp_standard"]])
3434

3535
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
3636
# saves around 20% of binary size and very significant build time.

tools/godotcpp.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ def options(opts, env):
244244
)
245245
)
246246

247+
opts.Add(
248+
key="cpp_standard",
249+
help="The C++ standard to use. Minimum required: 'c++17'.",
250+
default=env.get("cpp_standard", "c++17"),
251+
)
252+
247253
opts.Add(
248254
EnumVariable(
249255
"optimize",

0 commit comments

Comments
 (0)