diff --git a/win32/build/confutils.js b/win32/build/confutils.js index bf88cdae442cd..6ded399567997 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -3394,10 +3394,13 @@ function toolset_setup_common_ldlags() ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt"); if (VS_TOOLSET) { - if (VCVERS >= 1900) { - if (PHP_SECURITY_FLAGS == "yes") { + if (PHP_SECURITY_FLAGS == "yes") { + if (VCVERS >= 1900) { ADD_FLAG('LDFLAGS', "/GUARD:CF"); } + if (VCVERS >= 1920) { + ADD_FLAG('LDFLAGS', "/CETCOMPAT"); + } } } }