]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: FindP4EST.cmake now export VERSION numbers as well
authorMatthias Maier <tamiko@kyomu.43-1.org>
Fri, 16 Aug 2013 21:23:01 +0000 (21:23 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Fri, 16 Aug 2013 21:23:01 +0000 (21:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@30318 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/modules/FindP4EST.cmake

index 06e031198a2c8214f0c1ad1530ff966a1d466f5a..654700adec1fe83c574d12ffe6de93706368df28 100644 (file)
 #   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

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


Typeset in Trocchi and Trocchi Bold Sans Serif.