I have some old code which is compiled with packing of 1-byte (argument /Zp1
) Struct Member Alignment and I'm adding unit testing with gTest to them. I'm using vcpkg
to install gTest, but it is compiled using the default setting of 8-byte packing. I'm on Windows with VS2019.
Is it possible to specify which packing to use (parameter /Zp
) with vcpkg
?
As it isn't possible to change the Struct Member Alignment of the libraries with
vcpkg
during compilation: I had to change my code to use different packing alignments, when including the headers of these libraries.Everywhere I use the headers of gTest or other libraries provided by
vcpkg
, I enclosed these with#pragma pack(push, n)
and#pragma pack(pop)
. The value ofn
depends on default settings, which in my case is8
.It's not the best solution, but at least a workaround to use
vcpkg
with code, that uses a different packing alignment.