SCons: Use CXXFLAGS to disable exceptions, it's only for C++

Following discussion in https://github.com/godotengine/godot-cpp/pull/1216.

(cherry picked from commit 3bfcbe7946)
This commit is contained in:
Rémi Verschelde 2023-10-19 16:28:07 +02:00 committed by Yuri Sizov
parent 10eafe236c
commit 93becd4d2e
2 changed files with 5 additions and 5 deletions

View File

@ -707,9 +707,9 @@ if selected_platform in platform_list:
if env.msvc: if env.msvc:
env.Append(CPPDEFINES=[("_HAS_EXCEPTIONS", 0)]) env.Append(CPPDEFINES=[("_HAS_EXCEPTIONS", 0)])
else: else:
env.Append(CCFLAGS=["-fno-exceptions"]) env.Append(CXXFLAGS=["-fno-exceptions"])
elif env.msvc: elif env.msvc:
env.Append(CCFLAGS=["/EHsc"]) env.Append(CXXFLAGS=["/EHsc"])
# Configure compiler warnings # Configure compiler warnings
if env.msvc: # MSVC if env.msvc: # MSVC

View File

@ -114,9 +114,9 @@ if env["disable_exceptions"]:
# OIDN hard-requires exceptions, so we re-enable them here. # OIDN hard-requires exceptions, so we re-enable them here.
if env.msvc and ("_HAS_EXCEPTIONS", 0) in env_thirdparty["CPPDEFINES"]: if env.msvc and ("_HAS_EXCEPTIONS", 0) in env_thirdparty["CPPDEFINES"]:
env_thirdparty["CPPDEFINES"].remove(("_HAS_EXCEPTIONS", 0)) env_thirdparty["CPPDEFINES"].remove(("_HAS_EXCEPTIONS", 0))
env_thirdparty.AppendUnique(CCFLAGS=["/EHsc"]) env_thirdparty.AppendUnique(CXXFLAGS=["/EHsc"])
elif not env.msvc and "-fno-exceptions" in env_thirdparty["CCFLAGS"]: elif not env.msvc and "-fno-exceptions" in env_thirdparty["CXXFLAGS"]:
env_thirdparty["CCFLAGS"].remove("-fno-exceptions") env_thirdparty["CXXFLAGS"].remove("-fno-exceptions")
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources) env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
env.modules_sources += thirdparty_obj env.modules_sources += thirdparty_obj