aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cxx/init.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/cxx/init.cxx')
-rw-r--r--libbuild2/cxx/init.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx
index ad0dd05..e2d7343 100644
--- a/libbuild2/cxx/init.cxx
+++ b/libbuild2/cxx/init.cxx
@@ -189,6 +189,17 @@ namespace build2
if (!o.empty ())
prepend (move (o));
+ // Since VC 15.7 we can get a (more) accurate __cplusplus value if
+ // we ask for it with /Zc:__cplusplus:
+ //
+ // https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
+ //
+ if (mj > 19 || (mj == 19 && mi >= 14))
+ {
+ if (!find_option_prefix ("/Zc:__cplusplus", mode))
+ prepend ("/Zc:__cplusplus");
+ }
+
break;
}
case compiler_class::gcc: