From 5f1d4ba7edb541e7119734ce59d13a2bf237c6ea Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Fri, 16 Aug 2013 21:23:01 +0000 Subject: [PATCH] CMake: FindP4EST.cmake now export VERSION numbers as well git-svn-id: https://svn.dealii.org/trunk@30318 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/modules/FindP4EST.cmake | 28 ++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/deal.II/cmake/modules/FindP4EST.cmake b/deal.II/cmake/modules/FindP4EST.cmake index 06e031198a..654700adec 100644 --- a/deal.II/cmake/modules/FindP4EST.cmake +++ b/deal.II/cmake/modules/FindP4EST.cmake @@ -21,6 +21,11 @@ # P4EST_LIBRARIES # P4EST_INCLUDE_DIRS # P4EST_WITH_MPI +# P4EST_VERSION +# P4EST_VERSION_MAJOR +# P4EST_VERSION_MINOR +# P4EST_VERSION_SUBMINOR +# P4EST_VERSION_POINT # INCLUDE(FindPackageHandleStandardArgs) @@ -50,7 +55,7 @@ ENDIF() # given, take what we chose for p4est. # -FIND_PATH(P4EST_INCLUDE_DIR p4est.h +FIND_PATH(P4EST_INCLUDE_DIR p4est_config.h HINTS ${P4EST_DIR} PATH_SUFFIXES @@ -121,6 +126,27 @@ IF(P4EST_FOUND) SET(P4EST_WITH_MPI TRUE) ENDIF() + # + # Extract version numbers: + # + FILE(STRINGS "${P4EST_INCLUDE_DIR}/p4est_config.h" P4EST_VERSION + REGEX "#define P4EST_VERSION \"") + STRING(REGEX REPLACE "^.*P4EST_VERSION.*\"([0-9]+.*)\".*" "\\1" + P4EST_VERSION "${P4EST_VERSION}" + ) + STRING(REGEX REPLACE + "^([0-9]+).*$" "\\1" + P4EST_VERSION_MAJOR "${P4EST_VERSION}") + STRING(REGEX REPLACE + "^[0-9]+\\.([0-9]+).*$" "\\1" + P4EST_VERSION_MINOR "${P4EST_VERSION}") + STRING(REGEX REPLACE + "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" + P4EST_VERSION_SUBMINOR "${P4EST_VERSION}") + STRING(REGEX REPLACE + "^[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" + P4EST_VERSION_POINT "${P4EST_VERSION}") + MARK_AS_ADVANCED(P4EST_DIR) ELSE() SET(P4EST_DIR "" CACHE PATH -- 2.39.5