From 808b6557d656f0b1efe1f59c423f03303eafc7f2 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Fri, 1 Aug 2025 10:20:39 +1000 Subject: [PATCH] maint(common): use `cpp_std=c++17` in meson project default_options We attempted to set the C++ version in standard.meson.build, but this does not work well as the option name varies by platform, and it also triggers a warning in meson. This fix moves the setting into each meson.build project() default_options. As there are only a handful of these, the maintenance burden is not high. Fixes: #14432 Relates-to: #14355 Build-bot: build Test-bot: skip --- core/meson.build | 1 + developer/src/kmcmplib/meson.build | 2 +- linux/ibus-keyman/meson.build | 1 + linux/keyman-system-service/meson.build | 1 + linux/mcompile/keymap/meson.build | 1 + mac/mcompile/meson.build | 1 + resources/build/meson/standard.meson.build | 6 ------ 7 files changed, 6 insertions(+), 7 deletions(-) diff --git a/core/meson.build b/core/meson.build index a5dffb5ede..01e016ad27 100644 --- a/core/meson.build +++ b/core/meson.build @@ -9,6 +9,7 @@ project('keyman_core', 'cpp', 'c', version: files('../VERSION.md'), license: 'MIT', default_options : ['buildtype=release', + 'cpp_std=c++17', 'b_vscrt=static_from_buildtype', 'warning_level=2', 'debug=true'], diff --git a/developer/src/kmcmplib/meson.build b/developer/src/kmcmplib/meson.build index 0493c504f4..935f8496f1 100644 --- a/developer/src/kmcmplib/meson.build +++ b/developer/src/kmcmplib/meson.build @@ -8,7 +8,7 @@ project('kmcmplib', 'cpp', 'c', version: files('../../../VERSION.md'), license: 'MIT', default_options : ['buildtype=release', - 'cpp_std=c++14', + 'cpp_std=c++17', 'b_vscrt=static_from_buildtype', 'default_library=static', 'debug=true']) diff --git a/linux/ibus-keyman/meson.build b/linux/ibus-keyman/meson.build index 3d0bbf0fce..f7a0eb7c7f 100644 --- a/linux/ibus-keyman/meson.build +++ b/linux/ibus-keyman/meson.build @@ -1,5 +1,6 @@ project('ibus-keyman', 'c', 'cpp', version: files('../../VERSION.md'), + default_options: ['cpp_std=c++17'], license: 'GPL-2+', meson_version: '>=1.0') diff --git a/linux/keyman-system-service/meson.build b/linux/keyman-system-service/meson.build index b6f16e82f8..6f950ba59f 100644 --- a/linux/keyman-system-service/meson.build +++ b/linux/keyman-system-service/meson.build @@ -1,5 +1,6 @@ project('keyman-system-service', 'c', 'cpp', version: files('../../VERSION.md'), + default_options: ['cpp_std=c++17'], license: 'MIT', meson_version: '>=1.0') diff --git a/linux/mcompile/keymap/meson.build b/linux/mcompile/keymap/meson.build index b6d489902c..af9c84017e 100644 --- a/linux/mcompile/keymap/meson.build +++ b/linux/mcompile/keymap/meson.build @@ -1,6 +1,7 @@ project( 'mcompile', 'c', 'cpp', version: files('../../../VERSION.md'), + default_options: ['cpp_std=c++17'], license: 'MIT', meson_version: '>=1.0', ) diff --git a/mac/mcompile/meson.build b/mac/mcompile/meson.build index 2429799442..6a156752ab 100644 --- a/mac/mcompile/meson.build +++ b/mac/mcompile/meson.build @@ -1,5 +1,6 @@ project('mcompile', 'c', 'cpp', version: files('../../VERSION.md'), + default_options: ['cpp_std=c++17'], license: 'MIT', meson_version: '>=1.0') diff --git a/resources/build/meson/standard.meson.build b/resources/build/meson/standard.meson.build index 300a00d8e9..6345e67fb2 100644 --- a/resources/build/meson/standard.meson.build +++ b/resources/build/meson/standard.meson.build @@ -16,12 +16,6 @@ cpp_compiler = meson.get_compiler('cpp') c_compiler = meson.get_compiler('c') -# Unfortunately this outputs a warning: 'Consider using the built-in option -# for language standard version instead of using "-std=c++17".' -# But that is not possible to do after creating the project... -# See also https://github.com/mesonbuild/meson/issues/10685 -add_project_arguments('-std=c++17', language: 'cpp') - # # Standard informational messages for our builds #