diff --git a/hatch_cpp/config.py b/hatch_cpp/config.py index 9e9c4d8..1b53dff 100644 --- a/hatch_cpp/config.py +++ b/hatch_cpp/config.py @@ -93,7 +93,9 @@ def generate(self): def execute(self): for command in self.commands: - system_call(command) + ret = system_call(command) + if ret != 0: + raise RuntimeError(f"hatch-cpp build command failed with exit code {ret}: {command}") return self.commands def cleanup(self): diff --git a/hatch_cpp/toolchains/common.py b/hatch_cpp/toolchains/common.py index 4a42b27..133728a 100644 --- a/hatch_cpp/toolchains/common.py +++ b/hatch_cpp/toolchains/common.py @@ -323,7 +323,9 @@ def get_compile_flags(self, library: HatchCppLibrary, build_type: BuildType = "r flags += " " + " ".join(f"/U{macro}" for macro in effective_undef_macros) flags += " /EHsc /DWIN32" if library.std: - flags += f" /std:{library.std}" + # MSVC minimum is c++14; clamp older standards + std = library.std if library.std not in ("c++11", "c++0x") else "c++14" + flags += f" /std:{std}" # clean while flags.count(" "): flags = flags.replace(" ", " ")