Skip to content

Commit 0e46d2e

Browse files
committed
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
1 parent 244554b commit 0e46d2e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/pygccxml/parser/source_reader.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def __create_command_line_castxml(self, source_file, xmlfile):
121121
"your xml_generator_configuration_t(), or add it to your " +
122122
"pygccxml configuration file."))
123123

124+
stdcxx_switch = self.__cxx_std.stdcxx
124125
# Platform specific options
125126
if platform.system() == 'Windows':
126127
compilers = ("mingw", "g++", "gcc")
@@ -135,14 +136,16 @@ def __create_command_line_castxml(self, source_file, xmlfile):
135136
if self.__config.compiler == 'msvc9':
136137
cmd.append('"-D_HAS_TR1=0"')
137138
cmd.append('--castxml-cc-msvc ')
139+
# msvc uses std:c++XX format instead of std=c++XX
140+
stdcxx_switch = stdcxx_switch.replace('=',':')
138141
else:
139142
# On mac or linux, use gcc or clang (the flag is the same)
140143
cmd.append('--castxml-cc-gnu ')
141144

142145
if self.__cxx_std.is_implicit:
143146
std_flag = ''
144147
else:
145-
std_flag = ' ' + self.__cxx_std.stdcxx + ' '
148+
std_flag = ' ' + stdcxx_switch + ' '
146149

147150
ccflags = self.__config.ccflags
148151
if std_flag:

0 commit comments

Comments
 (0)