MACRO(FEATURE_P4EST_FIND_EXTERNAL var)
FIND_PACKAGE(P4EST)
- FIND_PACKAGE(SC)
-
- #
- # TODO: Check for mpi consistency...
- #
+ FIND_PACKAGE(SC) # TODO
IF(P4EST_FOUND AND SC_FOUND)
- SET(${var} TRUE)
+
+ #
+ # Check whether p4est supports mpi:
+ #
+ LIST(APPEND CMAKE_REQUIRED_INCLUDES ${P4EST_INCLUDE_DIR})
+ CHECK_CXX_SOURCE_COMPILES(
+ "
+ #include <p4est_config.h>
+ #ifndef P4EST_MPI
+ # error p4est compiled without mpi support
+ invalid
+ #endif
+ int main() { return 0; }
+ "
+ P4EST_WITH_MPI)
+ LIST(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES ${P4EST_INCLUDE_DIR}/p4est_config.h)
+
+ IF(NOT P4EST_WITH_MPI)
+ MESSAGE(WARNING "\n"
+ "Could not find a sufficient p4est installation: "
+ "P4est has to be configured with MPI support enabled.\n\n"
+ )
+ ELSE()
+ SET(${var} TRUE)
+ ENDIF()
+
ENDIF()
ENDMACRO()
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams