From 07e91e8afa6b1b7bd20efa5aae2c3accfe85f871 Mon Sep 17 00:00:00 2001 From: Christoph Conrads Date: Fri, 1 Oct 2021 16:27:22 +0200 Subject: med: work around "could not find TARGET hdf5" error (#25312) Fixes #24671, fixes #26051 --- .../repos/builtin/packages/med/med-4.1.0-hdf5-target.patch | 13 +++++++++++++ var/spack/repos/builtin/packages/med/package.py | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 var/spack/repos/builtin/packages/med/med-4.1.0-hdf5-target.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/med/med-4.1.0-hdf5-target.patch b/var/spack/repos/builtin/packages/med/med-4.1.0-hdf5-target.patch new file mode 100644 index 0000000000..18427d54d6 --- /dev/null +++ b/var/spack/repos/builtin/packages/med/med-4.1.0-hdf5-target.patch @@ -0,0 +1,13 @@ +diff --git a/config/cmake_files/FindMedfileHDF5.cmake b/config/cmake_files/FindMedfileHDF5.cmake +index fbadbf4..5ed78f5 100644 +--- a/config/cmake_files/FindMedfileHDF5.cmake ++++ b/config/cmake_files/FindMedfileHDF5.cmake +@@ -115,7 +115,7 @@ IF (HDF5_FOUND) + # HDF5 was compiled with MPI support + # Unfortunately HDF5 doesn't expose its MPI configuration easily ... + # We sniff the properties of the HDF5 target which should also be there: +- GET_PROPERTY(_lib_lst TARGET hdf5 PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG) ++ GET_PROPERTY(_lib_lst TARGET hdf5-shared PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG) + FOREACH(s ${_lib_lst}) + STRING(FIND "${s}" "mpi." _res) # should cover WIN(?) and LINUX + IF(_res GREATER -1) diff --git a/var/spack/repos/builtin/packages/med/package.py b/var/spack/repos/builtin/packages/med/package.py index fe8944a3eb..5e4919cbf4 100644 --- a/var/spack/repos/builtin/packages/med/package.py +++ b/var/spack/repos/builtin/packages/med/package.py @@ -30,11 +30,15 @@ class Med(CMakePackage): depends_on('hdf5@1.10.2:1.10.7+mpi', when='@4.0.0:+mpi') depends_on('hdf5@:1.8.22~mpi', when='@3.2.0~mpi') depends_on('hdf5@1.10.2:1.10.7~mpi', when='@4.0.0:~mpi') + # the "TARGET hdf5" patch below only works with HDF5 shared library builds + depends_on('hdf5+shared', when='@4.0.0:4.1.99') conflicts("@4.1.0", when="~shared", msg="Link error when static") # C++11 requires a space between literal and identifier patch('add_space.patch', when='@3.2.0') + # fix problem where CMake "could not find TARGET hdf5" + patch('med-4.1.0-hdf5-target.patch', when='@4.0.0:4.1.99') def cmake_args(self): spec = self.spec -- cgit v1.2.3-60-g2f50