cpp: Add compat header for variant

In order to work around Boost.Variant and Boost.MPL type list size
limits in earlier versions of Boost, add functional cmake check and
manually increase the limits if using a buggy version.  This fixes
the travis build.