Merge pull request #94078 from Repiteo/scons/msvc-flag-fix

SCons: Don't override cl flags on msvc
This commit is contained in:
Rémi Verschelde 2024-07-22 14:12:45 +02:00
commit a50fe87b89
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 6 additions and 1 deletions

View File

@ -301,7 +301,6 @@ def setup_msvc_manual(env: "SConsEnvironment"):
print("Using VCVARS-determined MSVC, arch %s" % (env_arch)) print("Using VCVARS-determined MSVC, arch %s" % (env_arch))
# FIXME: Likely overwrites command-line options for the msvc compiler. See #91883.
def setup_msvc_auto(env: "SConsEnvironment"): def setup_msvc_auto(env: "SConsEnvironment"):
"""Set up MSVC using SCons's auto-detection logic""" """Set up MSVC using SCons's auto-detection logic"""
@ -334,6 +333,12 @@ def setup_msvc_auto(env: "SConsEnvironment"):
env.Tool("msvc") env.Tool("msvc")
env.Tool("mssdk") # we want the MS SDK env.Tool("mssdk") # we want the MS SDK
# Re-add potentially overwritten flags.
env.AppendUnique(CCFLAGS=env.get("ccflags", "").split())
env.AppendUnique(CXXFLAGS=env.get("cxxflags", "").split())
env.AppendUnique(CFLAGS=env.get("cflags", "").split())
env.AppendUnique(RCFLAGS=env.get("rcflags", "").split())
# Note: actual compiler version can be found in env['MSVC_VERSION'], e.g. "14.1" for VS2015 # Note: actual compiler version can be found in env['MSVC_VERSION'], e.g. "14.1" for VS2015
print("Using SCons-detected MSVC version %s, arch %s" % (env["MSVC_VERSION"], env["arch"])) print("Using SCons-detected MSVC version %s, arch %s" % (env["MSVC_VERSION"], env["arch"]))