From 93a148cde60f9f9f79e283be83001747e3f5dfef Mon Sep 17 00:00:00 2001 From: Elliot <35050275+apache-hb@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:18:01 -0500 Subject: [PATCH] fix warning when compiling with clang-cl --- meson.build | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 1014159be..71273159b 100644 --- a/meson.build +++ b/meson.build @@ -22,9 +22,16 @@ pkgmod = import('pkgconfig') cpp = meson.get_compiler('cpp') null_dep = dependency('', required: false) -# Enforce C++14 requirement for MSVC STL -if ['clang', 'clang-cl'].contains(cpp.get_id()) and cpp.get_define('_MSC_FULL_VER') != '' - add_project_arguments('-std=c++14', language: 'cpp') +# Only perform these checks if cpp_std is c++11 as setting -std directly +# produces a warning from meson. +if get_option('cpp_std') == 'c++11' + # Enforce C++14 requirement for MSVC STL + if cpp.get_id() == 'clang' and cpp.get_define('_MSC_FULL_VER') != '' + add_project_arguments('-std=c++14', language: 'cpp') + elif cpp.get_id() == 'clang-cl' + # Clang-cl produces a warning when using -std=c++14, but not when using /std:c++14 + add_project_arguments('/std:c++14', language : 'cpp') + endif endif if cpp.get_argument_syntax() == 'msvc'