Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions repos/spack_repo/builtin/packages/netcdf_c/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ class NetcdfC(CMakePackage, AutotoolsPackage):

build_system("cmake", "autotools", default=default_build_system)

@when("build_system=cmake")
def patch(self):
"""Fix bad code in ncgen/CMakeLists.txt that removes
the rpath for dependencies like hdf5."""
Expand All @@ -297,6 +298,16 @@ def patch(self):
"ncgen/CMakeLists.txt",
string=True
)
# https://github.com/Unidata/netcdf-c/issues/3199
filter_file(
"CHECK_FUNCTION_EXISTS(MPI_Comm_f2c HAVE_MPI_COMM_F2C)",
"""if(MPI_mpi_LIBRARY)
SET(CMAKE_REQUIRED_LIBRARIES ${MPI_mpi_LIBRARY} ${CMAKE_REQUIRED_LIBRARIES})
endif()
CHECK_FUNCTION_EXISTS(MPI_Comm_f2c HAVE_MPI_COMM_F2C)""",
"CMakeLists.txt",
string = True
)

def setup_run_environment(self, env: EnvironmentModifications) -> None:
if self.spec.satisfies("@4.9.0:+shared"):
Expand Down