From 8186300c6de05d733ca055a3e6580417be5256ea Mon Sep 17 00:00:00 2001 From: Christos Tsolakis Date: Mon, 15 Apr 2024 16:05:08 -0400 Subject: [PATCH] source_reader: transform std=c++XX -> std:c++XX when using mscv see https://learn.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version --- src/pygccxml/parser/source_reader.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pygccxml/parser/source_reader.py b/src/pygccxml/parser/source_reader.py index f2d1cb9e..f64ae4e1 100644 --- a/src/pygccxml/parser/source_reader.py +++ b/src/pygccxml/parser/source_reader.py @@ -121,6 +121,7 @@ def __create_command_line_castxml(self, source_file, xmlfile): "your xml_generator_configuration_t(), or add it to your " + "pygccxml configuration file.")) + stdcxx_switch = self.__cxx_std.stdcxx # Platform specific options if platform.system() == 'Windows': compilers = ("mingw", "g++", "gcc") @@ -135,6 +136,8 @@ def __create_command_line_castxml(self, source_file, xmlfile): if self.__config.compiler == 'msvc9': cmd.append('"-D_HAS_TR1=0"') cmd.append('--castxml-cc-msvc ') + # msvc uses std:c++XX format instead of std=c++XX + stdcxx_switch = stdcxx_switch.replace('=', ':') else: # On mac or linux, use gcc or clang (the flag is the same) cmd.append('--castxml-cc-gnu ') @@ -142,7 +145,7 @@ def __create_command_line_castxml(self, source_file, xmlfile): if self.__cxx_std.is_implicit: std_flag = '' else: - std_flag = ' ' + self.__cxx_std.stdcxx + ' ' + std_flag = ' ' + stdcxx_switch + ' ' ccflags = self.__config.ccflags if std_flag: