diff --git a/cmake/cef_variables.cmake.in b/cmake/cef_variables.cmake.in index 98cca6593..31989fe6d 100644 --- a/cmake/cef_variables.cmake.in +++ b/cmake/cef_variables.cmake.in @@ -329,11 +329,19 @@ if(OS_WINDOWS) # Configure use of the sandbox. option(USE_SANDBOX "Enable or disable use of the sandbox." ON) - if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1900 AND NOT MSVC_VERSION EQUAL 1910) - # The cef_sandbox.lib static library is currently built with VS2015, which - # is compatible with VS2015 and VS2017. It will not link successfully with - # other VS versions. - set(USE_SANDBOX OFF) + if(USE_SANDBOX) + # Check if the current MSVC version is compatible with the cef_sandbox.lib + # static library. + list(APPEND supported_msvc_versions + 1900 # VS2015 + 1910 # VS2017 <= 15.2 + 1911 # VS2017 >= 15.3 + ) + list(FIND supported_msvc_versions ${MSVC_VERSION} _index) + if (${_index} EQUAL -1) + message(WARNING "CEF sandbox is not compatible with the current MSVC version (${MSVC_VERSION})") + set(USE_SANDBOX OFF) + endif() endif() # Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385). diff --git a/tools/msvs_env.bat b/tools/msvs_env.bat index e7bb1cb8e..e4ed3c768 100644 --- a/tools/msvs_env.bat +++ b/tools/msvs_env.bat @@ -26,19 +26,32 @@ if %vcvars% == "none" goto found_vcvars if "%1" == "win64" goto check_win64 +:: Hardcoded list of MSVS paths for VS2017 32-bit builds. +set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars32.bat" +if exist %vcvars% goto found_vcvars +set vcvars="%PROGRAMFILES%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars32.bat" +if exist %vcvars% goto found_vcvars + :: Hardcoded list of MSVS paths for VS2015 32-bit builds. set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat" if exist %vcvars% goto found_vcvars set vcvars="%PROGRAMFILES%\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat" if exist %vcvars% goto found_vcvars +goto notfound_vcvars + :check_win64 +:: Hardcoded list of MSVS paths for VS2017 64-bit builds. +set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat" +if exist %vcvars% goto found_vcvars +set vcvars="%PROGRAMFILES%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat" +if exist %vcvars% goto found_vcvars + :: Hardcoded list of MSVS paths for VS2015 64-bit builds. set vcvars="%PROGRAMFILES(X86)%\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" if exist %vcvars% goto found_vcvars set vcvars="%PROGRAMFILES%\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat" if exist %vcvars% goto found_vcvars -goto notfound_vcvars :notfound_vcvars echo ERROR: Failed to find vcvars