From 70c19e312ae86919bd77b39d45fa35dc4b66d458 Mon Sep 17 00:00:00 2001 From: Marcel Metz Date: Sun, 21 Aug 2016 20:23:48 +0200 Subject: [PATCH] Use old boost::optional implementation for boost 1.61 Fixes #777 - boost::spirit v 1.61 relies on the fact that the `Variant` template type of `boost::spirit::qi::detail::find_substitute` typedefs a `types` subtype. - For the failing instantiation of `find_substition` a `boost::optional` is used as `Variant` template type. - `boost::optional` removed its `types` subtype implementation with commit [boost::optional b5b8414c0], which means that this type is missing on every boost version 1.61 and onwards (until fixed of course). - Using the BOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL reenables the old implementation of boost::optional, which provides a `types` subtype. This commits enables said define for boost 1.61 only, because I consider this an upstream bug. The upstream bug is tracked as [boost #12349]. [boost::optional b5b8414c0]: https://github.com/boostorg/optional/commit/b5b8414c069a2c5f16cc1f9813d069c8b36e2c35 [boost #12349]: https://svn.boost.org/trac/boost/ticket/12349 --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e70e72..65f1537 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,6 +143,16 @@ find_package(Boost ${MINIMUM_BOOST_VERSION} COMPONENTS chrono date_time filesyst find_package(ZLIB REQUIRED) find_package(Freetype REQUIRED) +if(${Boost_VERSION} EQUAL "106100") + # with boost 1.61 some boost::optional internals were changed. However + # boost::spirit relies on some API the old implementation provided. This + # define enables the usage of the old boost::optional implementation. + # boost upstream tracks this bug as #12349 + add_definitions( + -DBOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL + ) +endif() + include_directories( ${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}