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 of n
depends on default settings, which in my case is 8
.
// project specific headers
#include "version.hxx"
// 3rd party libraries (provided by vcpkg)
#pragma pack(push, 8)
#include <gtest/gtest.h>
#include <gtest/gmock.h>
#pragma pack(pop)
// STL
#include <vector>
using std::vector;
It's not the best solution, but at least a workaround to use vcpkg
with code, that uses a different packing alignment.