[mlpack-git] mlpack-1.0.x: Backport r17366. (1d7333c)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Wed Jan 7 11:58:27 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : mlpack-1.0.x
Link       : https://github.com/mlpack/mlpack/compare/0000000000000000000000000000000000000000...904762495c039e345beba14c1142fd719b3bd50e

>---------------------------------------------------------------

commit 1d7333c095f4fa7c1257ddfe55eb42ad4971cc19
Author: Ryan Curtin <ryan at ratml.org>
Date:   Sun Dec 7 19:32:26 2014 +0000

    Backport r17366.


>---------------------------------------------------------------

1d7333c095f4fa7c1257ddfe55eb42ad4971cc19
 CMake/FindArmadillo.cmake | 47 +++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 43 insertions(+), 4 deletions(-)

diff --git a/CMake/FindArmadillo.cmake b/CMake/FindArmadillo.cmake
index 9c7bffb..9db6c73 100644
--- a/CMake/FindArmadillo.cmake
+++ b/CMake/FindArmadillo.cmake
@@ -37,7 +37,6 @@ find_path(ARMADILLO_INCLUDE_DIR
 
 
 if(ARMADILLO_INCLUDE_DIR)
-
   # ------------------------------------------------------------------------
   #  Extract version information from <armadillo>
   # ------------------------------------------------------------------------
@@ -243,6 +242,12 @@ if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
         endif()
       endif()
 
+      if(NOT HDF5_FOUND)
+        # We tried but didn't find it.
+        message(FATAL_ERROR "Armadillo HDF5 support is enabled, but HDF5 "
+            "cannot be found on the system.  Consider disabling HDF5 support.")
+      endif()
+
       set(SUPPORT_INCLUDE_DIRS "${SUPPORT_INCLUDE_DIRS}" "${HDF5_INCLUDE_DIRS}")
       set(SUPPORT_LIBRARIES "${SUPPORT_LIBRARIES}" "${HDF5_LIBRARIES}")
     endif (NOT "${ARMA_USE_HDF5}" STREQUAL "")
@@ -250,7 +255,6 @@ if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
   else("${ARMA_USE_WRAPPER}" STREQUAL "")
     # Some older versions still require linking against HDF5 since they did not
     # wrap libhdf5.  This was true for versions older than 4.300.
-
     if(NOT "${ARMA_USE_HDF5}" STREQUAL "" AND
        "${ARMADILLO_VERSION_STRING}" VERSION_LESS "4.300.0")
       message(STATUS "Armadillo HDF5 support is enabled and manual linking is "
@@ -276,10 +280,45 @@ if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
             link_directories("${HDF5_LIBRARY_DIRS}")
           endif()
         endif()
+      endif()
+      
+      if(NOT HDF5_FOUND)
+        # We tried but didn't find it.
+        message(FATAL_ERROR "Armadillo HDF5 support is enabled, but HDF5 "
+            "cannot be found on the system.  Consider disabling HDF5 support.")
+      endif()
+        
+      set(SUPPORT_INCLUDE_DIRS "${HDF5_INCLUDE_DIRS}")
+      set(SUPPORT_LIBRARIES "${HDF5_LIBRARIES}")
+    endif()
+
+    # Versions between 4.300 and 4.500 did successfully wrap HDF5, but didn't have good support for setting the include directory correctly.
+    if(NOT "${ARMA_USE_HDF5}" STREQUAL "" AND
+       "${ARMADILLO_VERSION_STRING}" VERSION_GREATER "4.299.0" AND
+       "${ARMADILLO_VERSION_STRING}" VERSION_LESS "4.450.0")
+      message(STATUS "Armadillo HDF5 support is enabled and include "
+                     "directories must be found.")
+      find_package(HDF5)
+
+      if(NOT HDF5_FOUND)
+        # On Debian systems, the HDF5 package has been split into multiple
+        # packages so that it is co-installable.  But this may mean that the
+        # include files are hidden somewhere very odd that the FindHDF5.cmake
+        # script will not find.  Thus, we'll also quickly check pkgconfig to see
+        # if there is information on what to use there.
+        find_package(PkgConfig)
+        if (PKG_CONFIG_FOUND)
+          pkg_check_modules(HDF5 hdf5)
+        endif()
+      endif()
 
-        set(SUPPORT_INCLUDE_DIRS "${HDF5_INCLUDE_DIRS}")
-        set(SUPPORT_LIBRARIES "${HDF5_LIBRARIES}")
+      if(NOT HDF5_FOUND)
+        # We tried but didn't find it.
+        message(FATAL_ERROR "Armadillo HDF5 support is enabled, but HDF5 "
+            "cannot be found on the system.  Consider disabling HDF5 support.")
       endif()
+        
+      set(SUPPORT_INCLUDE_DIRS "${HDF5_INCLUDE_DIRS}")
     endif()
 
   endif("${ARMA_USE_WRAPPER}" STREQUAL "")



More information about the mlpack-git mailing list