mesonbuild/meson

MSVC: /Zc:__cplusplus not set when --backend=vs

Open

#14 469 ouverte le 10 avr. 2025

Voir sur GitHub
 (2 commentaires) (0 réactions) (0 assignés)Python (1 465 forks)batch import
backend:visualstudiobuggood first issue

Métriques du dépôt

Stars
 (4 978 stars)
Métriques de merge PR
 (Merge moyen 30j 19h) (63 PRs mergées en 30 j)

Description

Describe the bug When configuring with MSVC, /Zc:__cplusplus is not set when using --backend=vs, but it is set when using --backend=ninja.

To Reproduce Please include your meson.build files, preferably as a minimal toy example showing the issue. You may need to create simple source code files (don't include private/proprietary code).

meson.build:

project('zccplusplus', 'cpp', meson_version: '>= 1.0',
    default_options:['cpp_std=vc++14', 'buildtype=debug', 'b_vscrt=static_from_buildtype', 'b_ndebug=if-release'])

static_library('zccplusplus', 'zctest.cpp')

zctest.cpp:

#if __cplusplus == 199711L
#error Zc:__cplusplus flag not set
#endif

To reproduce: meson setup --backend=vs vbuild meson compile -C vbuild

The error is not shown if --backend=ninja is used instead.

Expected behavior /Zc:__cplusplus should be consistently set for every back-end when configuring with MSVC.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?

Native

  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)

Windows 11, with MSVC 17.13.6

  • what Python version are you using e.g. 3.8.0

The one bundled with the meson.msi installer.

  • what meson --version

1.7.1

  • what ninja --version if it's a Ninja build

1.12.1 (but it's the --backend=vs that is broken)

Not urgent, can be easily worked around by adding add_project_arguments('/Zc:__cplusplus', language: 'cpp') (because ninja isn't hurt by the redundant setting).

Guide contributeur