]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Allow finding user-installed HDF5 15199/head
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 11 May 2023 20:17:23 +0000 (16:17 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 11 May 2023 20:30:56 +0000 (16:30 -0400)
cmake/modules/FindDEAL_II_HDF5.cmake

index d6ff4cf6ddfef05b47ac5cac5770f37ef0cba40b..3bdf48fe08ab9173faa4eb884368545f910e7848 100644 (file)
@@ -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

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.