@@ -25,7 +25,7 @@ class HatchCppBuildConfig(BaseModel):
2525 name : str | None = Field (default = None )
2626 libraries : list [HatchCppLibrary ] = Field (default_factory = list )
2727 cmake : HatchCppCmakeConfiguration | None = Field (default = None )
28- platform : HatchCppPlatform | None = Field (default_factory = HatchCppPlatform .default )
28+ platform : HatchCppPlatform = Field (default_factory = HatchCppPlatform .default )
2929 vcpkg : HatchCppVcpkgConfiguration | None = Field (default_factory = HatchCppVcpkgConfiguration )
3030
3131 @model_validator (mode = "wrap" )
@@ -72,7 +72,7 @@ def generate(self):
7272 self ._active_toolchains .append ("vcpkg" )
7373 else :
7474 log .warning ("HATCH_CPP_VCPKG=1 set but no vcpkg configuration found; ignoring." )
75- elif vcpkg_override != "0" and self .vcpkg and Path (self .vcpkg .vcpkg ).exists ():
75+ elif vcpkg_override != "0" and self .vcpkg and self . vcpkg . vcpkg and Path (self .vcpkg .vcpkg ).exists ():
7676 self ._active_toolchains .append ("vcpkg" )
7777
7878 if self .libraries :
@@ -87,6 +87,7 @@ def generate(self):
8787
8888 # Collect toolchain commands
8989 if "vcpkg" in self ._active_toolchains :
90+ assert self .vcpkg is not None
9091 self .commands .extend (self .vcpkg .generate (self ))
9192
9293 if "vanilla" in self ._active_toolchains :
@@ -108,6 +109,7 @@ def generate(self):
108109 self .commands .append (f"{ compiler } { ' ' .join (library .sources )} { compile_flags } { link_flags } " )
109110
110111 if "cmake" in self ._active_toolchains :
112+ assert self .cmake is not None
111113 self .commands .extend (self .cmake .generate (self ))
112114
113115 return self .commands
0 commit comments