From: Daniel Arndt Date: Thu, 11 May 2023 20:17:23 +0000 (-0400) Subject: Allow finding user-installed HDF5 X-Git-Tag: v9.5.0-rc1~229^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de59f3804da884feaee02734f89da37be8c2bc66;p=dealii.git Allow finding user-installed HDF5 --- diff --git a/cmake/modules/FindDEAL_II_HDF5.cmake b/cmake/modules/FindDEAL_II_HDF5.cmake index d6ff4cf6dd..3bdf48fe08 100644 --- a/cmake/modules/FindDEAL_II_HDF5.cmake +++ b/cmake/modules/FindDEAL_II_HDF5.cmake @@ -35,7 +35,27 @@ set(HDF5_PREFER_PARALLEL TRUE) find_package(HDF5) set(_include_dirs "${HDF5_INCLUDE_DIRS}") -set(_libraries "${HDF5_LIBRARIES};${HDF5_HL_LIBRARIES}") +set(_libraries_tmp "${HDF5_LIBRARIES};${HDF5_HL_LIBRARIES}") + +# HDF5_LIBRARIES and HDF5_HL_LIBRARIES might contain targets or full paths to libraries +# try to find full paths in the former case +set(_libraries) +foreach(_library ${_libraries_tmp}) + if(TARGET ${_library}) + get_target_property(_configurations ${_library} IMPORTED_CONFIGURATIONS) + if(_configurations) + foreach(_configuration ${_configurations}) + get_target_property(_imported_location ${_library} IMPORTED_LOCATION_${_configuration}) + list(APPEND _libraries ${_imported_location}) + endforeach() + else() + get_target_property(_imported_location ${_library} IMPORTED_LOCATION) + list(APPEND _libraries ${_imported_location}) + endif() + else() + list(APPEND _libraries ${_library}) + endif() +endforeach() process_feature(HDF5 LIBRARIES