8000 Use C++17 compile flag when possible (#41) · PaulEcoffet/python_example@dd10f8f · GitHub
[go: up one dir, main page]

Skip to content

Commit dd10f8f

Browse files
horosinwjakob
authored andcommitted
Use C++17 compile flag when possible (pybind#41)
1 parent 7b86945 commit dd10f8f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

setup.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ def has_flag(compiler, flagname):
5252

5353

5454
def cpp_flag(compiler):
55-
"""Return the -std=c++[11/14] compiler flag.
55+
"""Return the -std=c++[11/14/17] compiler flag.
5656
57-
The c++14 is prefered over c++11 (when it is available).
57+
The newer version is prefered over c++11 (when it is available).
5858
"""
59-
if has_flag(compiler, '-std=c++14'):
60-
return '-std=c++14'
61-
elif has_flag(compiler, '-std=c++11'):
62-
return '-std=c++11'
63-
else:
64-
raise RuntimeError('Unsupported compiler -- at least C++11 support '
65-
'is needed!')
59+
flags = ['-std=c++17', '-std=c++14', '-std=c++11']
60+
61+
for flag in flags:
62+
if has_flag(compiler, flag): return flag
63+
64+
raise RuntimeError('Unsupported compiler -- at least C++11 support '
65+
'is needed!')
6666

6767

6868
class BuildExt(build_ext):

0 commit comments

Comments
 (0)
0