From: Daniel Arndt Date: Wed, 25 Oct 2017 08:54:30 +0000 (+0200) Subject: Check that Boost.Iostreams is usuable for an external BOOST package X-Git-Tag: v9.0.0-rc1~870^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=151c58c06afa51cb6d23ada27fd72396f79351db;p=dealii.git Check that Boost.Iostreams is usuable for an external BOOST package --- diff --git a/cmake/modules/FindBOOST.cmake b/cmake/modules/FindBOOST.cmake index 26e9a80c0a..57c35234c9 100644 --- a/cmake/modules/FindBOOST.cmake +++ b/cmake/modules/FindBOOST.cmake @@ -78,6 +78,51 @@ IF(Boost_FOUND) SET(BOOST_VERSION "${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}" ) + + IF(DEAL_II_WITH_ZLIB) + # + # Test that Boost.Iostreams is usuable. + # + RESET_CMAKE_REQUIRED() + PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}") + PUSH_CMAKE_REQUIRED("-L${Boost_LIBRARY_DIRS}") + SET(CMAKE_REQUIRED_LIBRARIES "-lboost_iostreams") + CHECK_CXX_SOURCE_COMPILES( + " + #include + #include + #include + #include + + int main() + { + std::string decompressed_buffer; + char test[1] = {'c'}; + + boost::iostreams::filtering_ostream decompressing_stream; + decompressing_stream.push(boost::iostreams::gzip_decompressor()); + decompressing_stream.push(boost::iostreams::back_inserter(decompressed_buffer)); + decompressing_stream.write (test, 1); + } + " + DEAL_II_BOOST_IOSTREAMS_USUABLE + ) + MESSAGE(STATUS "${DEAL_II_BOOST_IOSTREAMS_USUABLE}") + IF(${DEAL_II_BOOST_IOSTREAMS_USUABLE}) + MESSAGE(STATUS "Boost.Iostreams is usuable.") + ELSE() + MESSAGE(STATUS + "DEAL_II_WITH_ZLIB=ON requires Boost.Iostreams to be compiled " + "with zlib support but a simple test failed! " + "Therefore, the bundled boost package is used." + ) + SET(Boost_FOUND FALSE) + SET(Boost_LIBRARIES "") + SET(Boost_INCLUDE_DIRS "") + ENDIF() + RESET_CMAKE_REQUIRED() + ENDIF() + ENDIF() DEAL_II_PACKAGE_HANDLE(BOOST @@ -85,7 +130,7 @@ DEAL_II_PACKAGE_HANDLE(BOOST INCLUDE_DIRS REQUIRED Boost_INCLUDE_DIRS USER_INCLUDE_DIRS Boost_INCLUDE_DIRS CLEAR - Boost_DIR Boost_INCLUDE_DIR Boost_IOSTREAMS_LIBRARY_DEBUG + Boost_DIR Boost_INCLUDE_DIRS Boost_IOSTREAMS_LIBRARY_DEBUG Boost_IOSTREAMS_LIBRARY_RELEASE Boost_LIBRARY_DIR Boost_SERIALIZATION_LIBRARY_DEBUG Boost_SERIALIZATION_LIBRARY_RELEASE Boost_SYSTEM_LIBRARY_DEBUG Boost_SYSTEM_LIBRARY_RELEASE