From: Matthias Maier Date: Thu, 6 Apr 2017 01:26:28 +0000 (-0500) Subject: CMake: Also check for enabled zlib support in p4est X-Git-Tag: v8.5.0-rc2~2^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be664a514803745e7e60170809f8139de9d1238c;p=dealii.git CMake: Also check for enabled zlib support in p4est Even though we might not necessarily use zlib compression in p4est output at all, p4est might silently fail if zlib support is disabled. Work around this issue by always requiring a p4est installation with enabled zlib support. Closes #4151 --- diff --git a/cmake/configure/configure_p4est.cmake b/cmake/configure/configure_p4est.cmake index cfc0afcd3e..fbcfc67d58 100644 --- a/cmake/configure/configure_p4est.cmake +++ b/cmake/configure/configure_p4est.cmake @@ -55,6 +55,21 @@ MACRO(FEATURE_P4EST_FIND_EXTERNAL var) SET(${var} FALSE) ENDIF() + # + # Check whether p4est is built against zlib: + # + IF(NOT P4EST_WITH_ZLIB) + MESSAGE(STATUS "Insufficient p4est installation found: " + "p4est has to be configured with enabled zlib support." + ) + SET(P4EST_ADDITIONAL_ERROR_STRING + ${P4EST_ADDITIONAL_ERROR_STRING} + "Insufficient p4est installation found!\n" + "p4est has to be configured with enabled zlib support.\n" + ) + SET(${var} FALSE) + ENDIF() + CHECK_MPI_INTERFACE(P4EST ${var}) ENDIF() ENDMACRO() diff --git a/cmake/modules/FindP4EST.cmake b/cmake/modules/FindP4EST.cmake index 5fa4567111..145aef7019 100644 --- a/cmake/modules/FindP4EST.cmake +++ b/cmake/modules/FindP4EST.cmake @@ -20,6 +20,7 @@ # P4EST_LIBRARIES # P4EST_INCLUDE_DIRS # P4EST_WITH_MPI +# P4EST_WITH_ZLIB # P4EST_VERSION # P4EST_VERSION_MAJOR # P4EST_VERSION_MINOR @@ -116,6 +117,17 @@ IF(EXISTS ${P4EST_INCLUDE_DIR}/p4est_config.h) SET(P4EST_WITH_MPI TRUE) ENDIF() + # + # Is p4est built against zlib? + # + FILE(STRINGS "${P4EST_INCLUDE_DIR}/p4est_config.h" P4EST_ZLIB_STRING + REGEX "#define.*P4EST_HAVE_ZLIB 1") + IF("${P4EST_ZLIB_STRING}" STREQUAL "") + SET(P4EST_WITH_ZLIB FALSE) + ELSE() + SET(P4EST_WITH_ZLIB TRUE) + ENDIF() + # # Extract version numbers: #