vcpkg/ports/flann/fix-dependency-hdf5.patch
Jack·Boos·Yu 8f8f7168ee
[cmake] update to 3.19.2 (#14716)
* [cmake] update to 3.19.0

* update vmss

* [cmake] update to 3.19.1

* [solid3] Fix configure error, fix static definition

* [flann] Add feature hdf5 and fix it

* [highfive] Fix dependency hdf5

* [simage] Fix configure error

* [aws-c-common] Fix configure error

* [cmake] Update to 3.19.2

* Revert changes about cmake bug

* [VMSS] Update cmake path on Windows

* [cmake] Update cmake hash

* [minc] Fix dependency hdf5

* [cmake] Update cmake package name and path on MacOS

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2020-12-28 21:21:03 -08:00

54 lines
1.6 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ff331a..155cabe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,11 +75,17 @@ if (NOT PYTHON_EXECUTABLE)
endif()
endif()
+if (WITH_HDF5)
find_hdf5()
-if (NOT HDF5_FOUND)
- message(WARNING "hdf5 library not found, some tests will not be run")
+if (NOT hdf5_FOUND)
+ message(ERROR "hdf5 library not found")
else()
- include_directories(${HDF5_INCLUDE_DIR})
+ if (TARGET hdf5::hdf5-shared)
+ link_libraries(hdf5::hdf5-shared)
+ elseif (TARGET hdf5::hdf5-static)
+ link_libraries(hdf5::hdf5-static)
+ endif()
+endif()
endif()
if (USE_MPI OR HDF5_IS_PARALLEL)
diff --git a/cmake/flann_utils.cmake b/cmake/flann_utils.cmake
index 8aef8e0..747414f 100644
--- a/cmake/flann_utils.cmake
+++ b/cmake/flann_utils.cmake
@@ -21,21 +21,8 @@ endmacro(DISSECT_VERSION)
# workaround a FindHDF5 bug
macro(find_hdf5)
- find_package(HDF5)
-
- set( HDF5_IS_PARALLEL FALSE )
- foreach( _dir ${HDF5_INCLUDE_DIRS} )
- if( EXISTS "${_dir}/H5pubconf.h" )
- file( STRINGS "${_dir}/H5pubconf.h"
- HDF5_HAVE_PARALLEL_DEFINE
- REGEX "HAVE_PARALLEL 1" )
- if( HDF5_HAVE_PARALLEL_DEFINE )
- set( HDF5_IS_PARALLEL TRUE )
- endif()
- endif()
- endforeach()
- set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL
- "HDF5 library compiled with parallel IO support" )
+ find_package(hdf5 CONFIG)
+ set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL})
mark_as_advanced( HDF5_IS_PARALLEL )
endmacro(find_hdf5)