Skip to content

Commit 722cdb4

Browse files
authored
Merge pull request #88 from python-project-templates/tkp/hf2
raise if system calls fail, don't pass C++11 on msvc
2 parents f2bb298 + 3136a3d commit 722cdb4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

hatch_cpp/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ def generate(self):
9393

9494
def execute(self):
9595
for command in self.commands:
96-
system_call(command)
96+
ret = system_call(command)
97+
if ret != 0:
98+
raise RuntimeError(f"hatch-cpp build command failed with exit code {ret}: {command}")
9799
return self.commands
98100

99101
def cleanup(self):

hatch_cpp/toolchains/common.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,9 @@ def get_compile_flags(self, library: HatchCppLibrary, build_type: BuildType = "r
323323
flags += " " + " ".join(f"/U{macro}" for macro in effective_undef_macros)
324324
flags += " /EHsc /DWIN32"
325325
if library.std:
326-
flags += f" /std:{library.std}"
326+
# MSVC minimum is c++14; clamp older standards
327+
std = library.std if library.std not in ("c++11", "c++0x") else "c++14"
328+
flags += f" /std:{std}"
327329
# clean
328330
while flags.count(" "):
329331
flags = flags.replace(" ", " ")

0 commit comments

Comments
 (0)