summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Conrads <christoph.conrads@inria.fr>2021-10-01 16:27:22 +0200
committerGitHub <noreply@github.com>2021-10-01 10:27:22 -0400
commit07e91e8afa6b1b7bd20efa5aae2c3accfe85f871 (patch)
treef10898a1e434dda188029c21b347213841e5aa46
parentc3c28d510f40b05e5b0816c9c0a0cf12193fb7cc (diff)
downloadspack-07e91e8afa6b1b7bd20efa5aae2c3accfe85f871.tar.gz
spack-07e91e8afa6b1b7bd20efa5aae2c3accfe85f871.tar.bz2
spack-07e91e8afa6b1b7bd20efa5aae2c3accfe85f871.tar.xz
spack-07e91e8afa6b1b7bd20efa5aae2c3accfe85f871.zip
med: work around "could not find TARGET hdf5" error (#25312)
Fixes #24671, fixes #26051
-rw-r--r--var/spack/repos/builtin/packages/med/med-4.1.0-hdf5-target.patch13
-rw-r--r--var/spack/repos/builtin/packages/med/package.py4
2 files changed, 17 insertions, 0 deletions
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