From be664a514803745e7e60170809f8139de9d1238c Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Wed, 5 Apr 2017 20:26:28 -0500 Subject: [PATCH] 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 --- cmake/configure/configure_p4est.cmake | 15 +++++++++++++++ cmake/modules/FindP4EST.cmake | 12 ++++++++++++ 2 files changed, 27 insertions(+) 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: # -- 2.39.5