Skip to content

Commit

Permalink
Merge pull request InsightSoftwareConsortium#2539 from blowekamp/FixH…
Browse files Browse the repository at this point in the history
…DF5InstalledFindPackage
  • Loading branch information
dzenanz authored May 17, 2021
2 parents 4fb80d3 + f83a0ba commit 7b402ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Modules/ThirdParty/HDF5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,23 @@ endif()
if(ITK_USE_SYSTEM_HDF5)

if(HDF5_DIR)
# When ITK's config is loaded, load HDF5 too.
set(ITKHDF5_EXPORT_CODE_INSTALL "
set(HDF5_DIR \"${HDF5_DIR}\")
find_package(HDF5 REQUIRED NO_MODULE)
set(_HDF5_DIR_CODE "set(HDF5_DIR \"${HDF5_DIR}\")")
endif()
if(HDF5_NO_MODULE)
set(_HDF5_NO_MODULE_ARG "NO_MODULE")
endif()

# When ITK's config is loaded, load HDF5 too.
set(ITKHDF5_EXPORT_CODE_INSTALL "
${_HDF5_DIR_CODE}
find_package(HDF5 ${_HDF5_NO_MODULE_ARG} REQUIRED COMPONENTS CXX C)
")
set(ITKHDF5_EXPORT_CODE_BUILD "
if(NOT ITK_BINARY_DIR)
set(HDF5_DIR \"${HDF5_DIR}\")
find_package(HDF5 REQUIRED NO_MODULE)
${_HDF5_DIR_CODE}
find_package(HDF5 ${_HDF5_NO_MODULE_ARG} REQUIRED COMPONENTS CXX C)
endif()
")
endif()

if(BUILD_SHARED_LIBS)
if (TARGET hdf5-shared)
Expand Down
2 changes: 2 additions & 0 deletions Modules/ThirdParty/HDF5/itk-module-init.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ option(ITK_USE_SYSTEM_HDF5 "Use an outside build of HDF5." ${ITK_USE_SYSTEM_LIBR
mark_as_advanced(ITK_USE_SYSTEM_HDF5)

if(ITK_USE_SYSTEM_HDF5)
set(HDF5_NO_MODULE 1)
if(ITK_BUILD_SHARED_LIBS)
find_package(HDF5 QUIET NO_MODULE COMPONENTS CXX C shared)
else()
Expand All @@ -10,5 +11,6 @@ if(ITK_USE_SYSTEM_HDF5)

if(NOT HDF5_FOUND)
find_package(HDF5 REQUIRED COMPONENTS CXX C)
set(HDF5_NO_MODULE 0)
endif()
endif()

0 comments on commit 7b402ba

Please sign in to comment.